- 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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Sean de Wolski
2012-6-7
You actually don't want to do this!
Welcome to MATLAB Answers!
1 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!