在 MATLAB 中加载多个 .mat 文件
我有 110 个名为 time1.mat、time2.mat ...、time110.mat 的文件。我想将这些矩阵加载到 MATLAB 工作区中。
我一直使用 load -'ASCII' matrix.mat
加载当前文件夹中的 ASCII 矩阵文件。
所以我尝试这样做,
for i=1:10
filename=strcat('time',int2str(i),'.mat');
load -'ASCII' filename
end
但我收到 MATLAB 错误,因为
??? Error using ==> load
Unable to read file filename: No such file or directory.
�
当然字符串 filename
似乎被 MATLAB 正确评估为 time1.mat
。在第一次迭代中,它在负载线处崩溃。
有什么建议我应该如何做到这一点?
I have 110 files named time1.mat, time2.mat ..., time110.mat. I want to load these matrices into the MATLAB workspace.
I have always used load -'ASCII' matrix.mat
to load an ASCII matrix file in the current folder.
So I tried doing
for i=1:10
filename=strcat('time',int2str(i),'.mat');
load -'ASCII' filename
end
But I am getting a MATLAB error as
??? Error using ==> load
Unable to read file filename: No such file or directory.
�
Of course the string filename
seems to be evaluated correctly by MATLAB as time1.mat
. in the first iteration where it crashes at the load line.
Any suggestions how I should do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
load(filename, '-ascii')
Use
load(filename, '-ascii')