0
在Windows上,我使用mcc编译了一个MATLAB脚本,该脚本将结构作为其唯一参数并将其输出写为文件。当我尝试调用它使用将结构参数传递给Windows上的MATLAB mcc编译的可执行文件
func.exe "struct('field','data')"
或
func.exe struct('field','data')
我得到
Attempt to reference field of non-structure array.
Error in func (line 3)
MATLAB:nonStrucReference
传递的结构来未编译脚本,通过MATLAB的作品,例如Windows的CMD
matlab /nosplash /nodesktop /r "func(struct('field','data')),exit"
假设我还是想传递一个结构,而不是不同的参数(这样我就可以指定运行可选参数),有没有解决办法? (谷歌没有帮助!)
谢谢!
命令行参数是字符串,其他任何东西都是不可能的。 – Daniel 2015-04-01 17:42:01
您需要在函数中添加一个选项来接受字符串输入并评估它以获取实际数据。 – Navan 2015-04-01 17:47:42