How can I move the result of the 'why' function into the editor window and store it into a variable?

1 view (last 30 days)
Hi. I am trying to analyze the response generated by the 'why' function by storing it into a variable. The generated reponse is placed in the command window. I am trying to move the string from the command window into a variable in the command window. Is there a way to do that or is the 'why' function restricted to the command window?

Answers (2)

Kevin Holly
Kevin Holly on 15 Mar 2022
Edited: Kevin Holly on 15 Mar 2022
You could edit the function to provide an output.
open why
change
function why(n)
to
function a = why2(n)
You can save this function as why2 using Save As...
Then you should be able to save the output string as a variable.
a = why

Walter Roberson
Walter Roberson on 15 Mar 2022
NAME = evalc('why') ;

Categories

Find more on Holidays / Seasons in Help Center and File Exchange

Tags

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!