フィルターのクリア

How can I plot a multidimensional array?

9 ビュー (過去 30 日間)
Raúl Alonso Merino
Raúl Alonso Merino 2019 年 1 月 22 日
Hello, I want to create a gif from the data inside a 32x360x360 double array. The thing is I want to plot the 32 values for each 360x360, I mean plotting first 32x1x1, then 32x1x2, 32x1x3, 32x1x4, ..., 32x1x360, 32x2x1, 32x2x2, and so on making a gif until it reaches 32x360x360. Can this be done?
The next code is one I have if the vector was 32x129600. How can I change it to plot the other vector of one more dimension without reshaping it? As I would like to have a title for the gif with something like i = 1,2,3,4,...360 and j=1,2,3,4,...360 to see how it changes.
for i=1:JN
plot(Vector(:,i), 'k-', 'LineWidth', 2);
axis([startpoint finishpoint miny maxy])
xlabel('Time(s)')
ylabel('Relative Brightness')
grid on
% Capture the plot as an image
frame = getframe(h);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
% Write to the GIF File
if i == 1
imwrite(imind,cm,filename,'gif', 'Loopcount',inf,'DelayTime',0.1);
else
imwrite(imind,cm,filename,'gif','WriteMode','append','DelayTime',0.1);
end
end

採用された回答

Walter Roberson
Walter Roberson 2019 年 1 月 22 日
Make JN = (360*360) .
When you index with fewer indices than there are dimensions, then the last index acts like a linear index relative to that dimension and later. So Vector(:,360) would correspond to Vector(:,360,1) and Vector(:,361) would correspond to Vector(:,2,1)
  7 件のコメント
Walter Roberson
Walter Roberson 2019 年 1 月 28 日
You can exchange to for phi then for theta without changing the rest.
Raúl Alonso Merino
Raúl Alonso Merino 2019 年 1 月 28 日
Perfect, thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by