我在Matlab中有一个函数,里面有一些变量.我需要打印出variable_names(如果是异常等).我知道inputname函数,但它只适用于input_arguments.
mat = [ 1 2 ; 3 4 ] ;
% disp(['Error in var: ' ??(a)])
% desired ouput: Error in var: mat (and NOT 1 2 ; 3 4!)
Run Code Online (Sandbox Code Playgroud)
谢谢!
我想在matlab中的图例中使用变量的名称.这可能吗?
我的例子是:
function example(x1)
figure;
plot(x1.time, x1.value);
legend(x1);
end
Run Code Online (Sandbox Code Playgroud)
现在我想调用我的函数:
>> example(myvariable)
Run Code Online (Sandbox Code Playgroud)
我的传奇应该是这样的:
---------------
| -- myvariable |
---------------
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.