Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在从 .mat 文件中读取矩阵。在这种情况下,eval 的替代方法是什么?
load([folder filename]); a = eval(filename(1:end-4))*16
我听说 eval 太慢了...
如果您阅读这样的 mat 文件并且它确实包含一个矩阵,那么您不需要eval声明:
eval
mat = load([folder filename]); [a,matrixName,ext] = fileparts(filename); a = mat.(matrixName) * 16;
请检查 的内容mat。
mat