HOW to create 4D array and 3D array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
please help me to form 4D array for corresponding code of fortran REAL*8 C(-500:500,-500:500,1:4,1:4) and 3D array for REAL*8 C1(0:500,-500:500,1:4) in matlab
0 Kommentare
Antworten (1)
James Tursa
am 10 Mär. 2020
Bearbeitet: James Tursa
am 10 Mär. 2020
Fortran allows negative and 0 indexing, but MATLAB does not. There is no double class equivalent of this in MATLAB. You would have to create an array of the same size with positive indexing and manually adjust the indexing algorithms in your code. E.g., the Fortran code
REAL*8 C(-500:500,-500:500,1:4,1:4)
might be this in MATLAB
C = zeros(1001,1001,4,4);
and a Fortran indexing of C(-500,0,2,3) would be C(1,501,2,3) in MATLAB. I.e., Fortran C(i,j,k,m) becomes C(i+501,j+501,k,m) in MATLAB.
You could create a user-defined class to do this indexing adjustment, but it would take a bit of work and may not be worth it.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Fortran with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!