Convert 3D matrix in 2D data matrix

2 views (last 30 days)
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

Accepted Answer

Jan
Jan on 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?

More Answers (1)

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

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!