how is keep the output values in program?

Hi everybody, I ran the a program and got the results. After making a change in the same program, I ran it again and got the results. How can I compare the first results with the second results? i.e. how can I keep the first results?

回答 (1 件)

AndresVar
AndresVar 2022 年 2 月 11 日

0 投票

you can use save and load, here is a quick example:
% run once, save results
x = 1;
y = x+1;
save('case1.mat')
% modify and run again, save results
x = 1;
y = x+2;
save('case2.mat')
% later...
data1 = load("case1.mat");
data2 = load("case2.mat");
% then data1.y = 2 and data2.y=3
See the documentation on save and load for more uses

3 件のコメント

AndresVar
AndresVar 2022 年 2 月 11 日
also you can just rerun without clearing the result variables
previousResult = result;
clear variables -except "previousResult";
run script again without clearing previousResult.
Erkan
Erkan 2022 年 2 月 11 日
thanks for answer
Erkan
Erkan 2022 年 2 月 11 日
my results are a vector in the size 1x3000 and when i appoint to another variable, i don't see the results

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

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

リリース

R2020b

タグ

質問済み:

2022 年 2 月 10 日

コメント済み:

2022 年 2 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by