# How to save previous runs

조회 수: 4(최근 30일)
Peter Carchia 2021년 4월 9일
편집: Abhishek Gupta 2021년 4월 12일
Hellp, I am creating a projectile motion simulation. Each time I run it I have 3 graphs being created. I am wondering how I can save those 3 graphs without them being deleted when I enter new inputs. This is what I have now...
%Projectile motion of a golf ball (no air resistance)
t = 0:.5:7.8; %time vector
u = 41; %inital velocity
angle = [25; 55; 85] %optimal angle
g = 9.8;
ux =u.*cos(theta); %velocity x direction
uy = u.*sin(theta) %velocity y direction
x = ux*t; %equation of motion, constant velocity
y= uy*t -0.5*g*t.^2; %equation of motion, constant velocity, resisted by gravity
for j = 1:size(angle,1)
for i = 1:size(x,2)
% if(i>1) && (y1(i)<0) %stop plotting when ball hits the ground
% break;
% end
plot (x(j,i),y(j,i),('*'));
hold on;
pause(0.01);
end
end
title 'flight of golf ball'
xlabel 'meters'
ylabel 'meters'
hgreen = plot(x1, y1, 'g-');
hblack = plot(x2, y2, 'k-');
##### 댓글 수: 1표시숨기기 없음
KSSV 2021년 4월 9일
You have data matrix (x,y) already in hand......you can plot it any time.

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

### 답변(1개)

Abhishek Gupta 2021년 4월 12일
편집: Abhishek Gupta 2021년 4월 12일
Hi,
You can save the graphs with the save name having input variables, as follow: -
saveas(gcf, strcat('angles', {' '}, strjoin(string(angle)), '.png'));
The output figure name would be "angles 25 55 85.png" for the given input values.

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

### 범주

Find more on Guidance, Navigation, and Control (GNC) in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!
{"ft_lang_label":"__label__en","ft_lang_prob":0.6181433,"math_prob":0.9086803,"size":1570,"snap":"2022-40-2023-06","text_gpt3_token_len":557,"char_repetition_ratio":0.085568324,"word_repetition_ratio":0.018867925,"special_character_ratio":0.33312103,"punctuation_ratio":0.18206522,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9915533,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-02-04T18:19:22Z\",\"WARC-Record-ID\":\"<urn:uuid:70a4d301-87f1-47ca-90b0-8c2aec52b339>\",\"Content-Length\":\"129399\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cc782e60-b9d9-4bee-8785-2971eda32e2a>\",\"WARC-Concurrent-To\":\"<urn:uuid:435ec2d2-3746-462e-806f-cf5991ec68fb>\",\"WARC-IP-Address\":\"104.68.243.15\",\"WARC-Target-URI\":\"https://kr.mathworks.com/matlabcentral/answers/796967-how-to-save-previous-runs\",\"WARC-Payload-Digest\":\"sha1:EQWZYPRUZO4OSHSVLQ55Q47YK6SJCHFY\",\"WARC-Block-Digest\":\"sha1:LIPOT67O4HMXAHBGYKZ5MYMHAZ57HLNA\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764500151.93_warc_CC-MAIN-20230204173912-20230204203912-00694.warc.gz\"}"}