How to save ans workspace of a Function

8 views (last 30 days)
Dear All, I have A function that reads a file, when I use it it succeed to read the file but it put it in a workspace with the name "ans".
Can I save this to output txt file ??

Accepted Answer

Walter Roberson
Walter Roberson on 29 Jul 2018
output = NameOfYourFunction(whatever, arguments, are, appropriate, go, here);
save('NameOfOutputFile.txt', 'output', '-ascii', '-double');

More Answers (1)

Mohamed Gamal
Mohamed Gamal on 31 Jul 2018
Dear Walter Thank you for the information it works:)

Community Treasure Hunt

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

Start Hunting!