- FAQ
- doc mat2cell
- Why is the threed matrix bad? Why not just extract slices from it as necessary?
Extract columns of data from a 3D matrix and store each column as a new variable.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I'm a graduate student who just started using MATLAB. I've created a 3D matrix and would like to extract each column from the matrix and store it as its own variable. The code describes the response from a dipole at different locations (lx, ly, lz) within the earth at different receiver locations(stn_locx(l),stn_locy,stn_locz) at the surface. In the 2D sections of the matrix, each column represents the dipole location (x,y) and the corresponding rows in the column are the responses for the receiver locations. The "pages" of the matrix represent different depths for the dipole.
lx=-487.5:25:487.5;
ly=0;
lz=-1000:25:-25;
stn_locx=-500:25:500;
stn_locy=0;
stn_locz=0;
for n=1:size(lx')
for k=1:size(lz')
for l=1:size(stn_locx')
for h=1:size(m')
[Bx(l,n,k), By(l,n,k), Bz(l,n,k)] = dipole_prim([stn_locx(l),stn_locy,stn_locz],lx(n),ly,lz(k),[1,0,0]);
end
end
end
end
I know this may be an easy thing to do, but not being familiar with matlab I've been struggling with this for a couple days.
Any help would be greatly appreciated!
Thanks,
Josh
0 comentarios
Respuestas (1)
Sean de Wolski
el 7 de Jun. de 2012
You actually don't want to do this!
Welcome to MATLAB Answers!
1 comentario
Ver también
Categorías
Más información sobre Matrix Indexing 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!