creating a loop for pcolor values

i have an x and y matrix that are each 547x599 and a z matrix that has a time step (547x599x193). how do i make a loop that will plot each matrix for each of the 193 time steps using pcolor? (also using the pause command so it pauses before each plot)

답변 (2개)

Image Analyst
Image Analyst 2018년 11월 4일

0 개 추천

Is this what you want?
for k = 1 : size(z, 3)
pcolor(z(:,:,k));
drawnow;
pause(0.3);
end

댓글 수: 1

joshua bromberg
joshua bromberg 2018년 11월 4일
| No, check the photos I posted below that might give you a better idea of what I am trying to do. Thanks |

댓글을 달려면 로그인하십시오.

joshua bromberg
joshua bromberg 2018년 11월 4일

0 개 추천

I have to plot the matrix’s globalx, globaly, and zb. Attached is the loop I tried but it didn’t work. Any ideas?

댓글 수: 6

Walter Roberson
Walter Roberson 2018년 11월 4일
Use zzb{i} instead of, zzb(i)
joshua bromberg
joshua bromberg 2018년 11월 5일
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in xbeach (line 34) zzb(i)=zb(:,:,i);
Image Analyst
Image Analyst 2018년 11월 5일
You didn't do what he said - to use braces. You just used parentheses again. Looks like you really need to read the FAQ: https://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
Alternatively you can just use zb(:,:,i) like I showed in my answer. This extracts and shows just one slice/plane of the zb volumetric image.
joshua bromberg
joshua bromberg 2018년 11월 5일
I used the brackets and it gave the error that I posted. I’ll try what you said also.
joshua bromberg
joshua bromberg 2018년 11월 5일
Cell contents reference from a non-cell array object.
Error in xbeach (line 34) zzb{i}=zb{:,:,i};
zzb{i}=zb(:,:,i);

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2018년 11월 4일

댓글:

2018년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by