Extract columns of data from a 3D matrix and store each column as a new variable.
Ältere Kommentare anzeigen
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
Antworten (1)
Sean de Wolski
am 7 Jun. 2012
0 Stimmen
You actually don't want to do this!
- FAQ
- doc mat2cell
- Why is the threed matrix bad? Why not just extract slices from it as necessary?
Welcome to MATLAB Answers!
1 Kommentar
brandon corwin
am 29 Okt. 2022
Why comment if you aren't going to provide a useful answer?
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!