HOW to create 4D array and 3D array
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
James Tursa
el 10 de Mzo. de 2020
Editada: James Tursa
el 10 de Mzo. de 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 comentarios
Ver también
Categorías
Más información sobre Fortran with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!