Convert 3D matrix in 2D data matrix

2 visualizzazioni (ultimi 30 giorni)
Willemijn Wolf
Willemijn Wolf il 15 Mar 2017
Risposto: Alexandra Harkai il 15 Mar 2017
Hi. I have to create for every x a graph that plots the results of Hquest2 v.s. h for 4 different t's. With Hrow I try to store data to plot for at least one of my x values. This is now an 4X1X20 but I would actually like to store this data in a 2D matrix (4x20). How can I efficiently do this in this loop?
xquest2 = [(labdaw/4), (labdaw/2.0), labdaw] ;
Hrow = zeros(i,j,h)
z = linspace(20,25,20) ;
for i = 1:3;
for j = 1:4;
for h = 1:20;
Hquest2(j,i,h) = H0*exp(-x(i)/labdaw - delta*z(h)/d1) *cos(omega*t(j) - a*x(i)/labdaw - delta*z(h)/d1);
end
end
Hrow = Hquest2(:,i,:);
end

Risposta accettata

Jan
Jan il 15 Mar 2017
I'm not sure what your question is. A guess:
Hrow = squeeze(Hquest2(:,i,:));
Hrow = zeros(i,j,h) looks confusing already. What is i,j,h here?

Più risposte (1)

Alexandra Harkai
Alexandra Harkai il 15 Mar 2017
Hrow = squeeze(Hquest2(:,i,:));

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by