Making a .gif from a for loop of plotted images

37 ビュー (過去 30 日間)
Eric Amerling
Eric Amerling 2021 年 4 月 15 日
回答済み: Image Analyst 2021 年 4 月 16 日
I have a few questions but first here is my code:
[file_list, path_n]=uigetfile('.csv','Grab the files you want to process','Multiselect','on')
if iscell(file_list) == 0
file_list = (file_list);
end
N = length(file_list);
for i = 1:N
filename = file_list{i};
data_in = xlsread([path_n filename])
hold on
depth = data_in(:,1);
Axial_stress = data_in(:,2);
plot(depth, Axial_stress)
xlabel('cm')
axis auto
ylabel('kbar')
legend(filename)
drawnow
end
The overall goal is to make a .gif (if possible, otherwise the drawnow function will work) of the different graphs that are coming from this data but I have a few questions
  1. How do i choose the colors for the lines? Any sort of line color choice function didnt seem to work for me, maybe I am missing something simple
  2. Is it possible to diplay the currently plotting graph in the legend then once all the graphs are plotted, have a "total" graph that has all the lines in the legend?
  3. How can I extract only the last 8 characters of the filename to use for the legend?
  4. How can i have the x axis min be set, but let the x axis max and y axis min and max be floating and not dependant on the first file in my for loop?

回答 (2 件)

Image Analyst
Image Analyst 2021 年 4 月 16 日
See if you can find something similar in a search of the forum:
Or the blogs and file exchange:

Image Analyst
Image Analyst 2021 年 4 月 16 日
To make a movie of the plots, see my attached demo.

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by