Saving the output from a function

16 ビュー (過去 30 日間)
Dustin Snedeger
Dustin Snedeger 2020 年 9 月 6 日
回答済み: Image Analyst 2020 年 9 月 6 日
Is there a way to save an output from a function for later use, For example if the function outputs an array can I call the function from another file and use the outputted array for calcuations after the fact. If there is away can you showcase how to do it thanks in advance just trying to learn!

採用された回答

Image Analyst
Image Analyst 2020 年 9 月 6 日
Of course. Read up on functions. Here is an example
m = rand(50);
theMax = max(m(:)) % Call the max() function for example.
% Save the result to 'answers.mat' file:
save('answers.mat', 'theMax');
Of you can use fprintf() or writematrix() or any number of other functions to save/export the variables you want.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by