Assume I have the function:
function name_the_paramlist(varargin)
% Print out varargin exactly how it is called as a string
Basically what I want it to do is, calling:
name_the_paramlist({'x', x}, y, 1, 'hello', [1, 2; 3, 4])
should print to the screen the string:
'{''x'', x}, y, 1, ''hello'', [1, 2; 3, 4]}'
Any suggestion?
ETA: The reason I want something like this is to hopefully resolve this question:
Matlab – how to create a subclass of dataset class keeping the dataset parameter constructor
Well, if you type this function call in a command line or run with F9 (so it get saved in the history) you can read the
history.mfile and get the last command as a string.Then get the argument part:
UPDATE:
Another idea. If you call this function from another script or function (m-file) you can use DBSTACK to return the m-file name and the current line number:
Then you can follow similar technique as in the first solution to read that line from the m-file and get argument part.
In opposite to the first solution this won’t work if run from command line or editor cell mode.