Convert 3D matrix in 2D data matrix

2 Ansichten (letzte 30 Tage)
Willemijn Wolf
Willemijn Wolf am 15 Mär. 2017
Beantwortet: Alexandra Harkai am 15 Mär. 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

Akzeptierte Antwort

Jan
Jan am 15 Mär. 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?

Weitere Antworten (1)

Alexandra Harkai
Alexandra Harkai am 15 Mär. 2017
Hrow = squeeze(Hquest2(:,i,:));

Kategorien

Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by