English
Source / code snippets

Matrix from Excel-CSV mathematically correctly. indexiert reading

 

p.specht

the Topic "Matrix from Excel-CSV mathematically correctly. indexiert einlesen" border apparently on a Kunstform: The mathematically korrekte Indexierung in a Matrix sounds known M_Zeilenindex,Spaltenindex, and both Indizes begin with 1. the would too in XProfan in the principle practicable, though then because of the Beginns with 0 a gewisse Platzverschwendung come off would. with calculated Indizes in Assembler but would the geradezu a catastrophe, therefore would I personally inclined, of zero lane To index:

Declare M![Zeilenanzahl-1,Spaltenanzahl-1]
with appeal: M![row-1,slot-1]
larger Matrizen writes one rather same in Excel (or Calc of OpenOffice, or in LibreOffice) and export these as CSV with Spaltentrenner ´|´ and Zeilentrenner (z.B. ´;´). One direktes reading from the File self wished me yet not gelingen, both programs use Kompressionsalgorithmen.  at that reading can but at least same The Description in shape of Lines- and Spaltenüberschriften rid, The with the Berechnung in XProfan ohnehin only onerous wären (mind you, It's all right naturally circa Operationen, The the Tabellenprogramm self not rule, about Spannbaumoptimierung etc.)


from technical Found disembark now The over a defined konstante row ongoing Spaltenindexe (in the Volksmund "Zeilenweises einlesen" called) NOT one after another in memory! XProfan, but z.B. too Pascal and Fortran, hold Arrays SPALTENWEISE in memory: first becomes The whole "Nullte Spalte" read, then The whole "Spalte 1" etc. this is for Assembler GUT, because the Spaltenelemente then for Operationen together in the schellen cache held go can.

The Translation the Indizes in Speicherplatz-Adressen goes then relatively simply:
Basisadresse the static definierten Matrix: Addr(M![0,0])
Laufindex = (Mathematischer_Spaltenindex-1)*Zeilenanzahl + (Mathematischher_Zeilenindex-1)
Adressversatz = Laufindex * 8

inverse counts:
Mathematischer_Spaltenindex = Laufindex \ Zeilenanzahl + 1
Mathematischer_Zeilenindex = (Laufindex mod Zeilenanzahl) + 1

Window Title "Excel-Matrix CSV-export mathematically correctly indexiert einlesen"
Window Style 24:CLS:font 2
Declare data$,tst$[],zl$[],n&,m&
data$="Tabelle|Über B1|Über C1|Über D1;"+\
"Seite A1|11|12|13;"+\
"Seite A2|21|22|23;"+\
"Seite A3|31|32|33;"+\
"Seite A4|41|42|43;"+\
"Seite A5|51|52|53"
tst$[]=explode(data$,";"):n&=sizeof(tst$[])-1
clear zl$[]:zl$[]=Explode(tst$[1],"|"):m&=sizeof(zl$[])-1
declare M![n&-1,m&-1],i&,j&

Whileloop 0,n&-1:i&=&Loop

    clear zl$[]:zl$[]=Explode(tst$[i&+1],"|"):m&=sizeof(zl$[])-1

    whileloop 0,m&-1:j&=&Loop

        M![i&,j&]=val(zl$[j&+1])

    endwhile

endwhile

Set("Decimals",1)
print "Numerischen part as Float ";n&;" X ";m&;"-Matrix read:\n"

Whileloop 0,n&-1:i&=&Loop

    whileloop 0,m&-1:j&=&Loop

        Print M![i&,j&],
        endwhile:print
        endwhile:print
        waitinput
        end
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/26/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.426 Views

Untitledvor 0 min.
H.Brill08/25/24
p.specht11/21/21
R.Schneider11/20/21
Uwe Lang11/20/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie