简体   繁体   English

将 .mat 转换为 csv 文件导致错误:matlab

[英]convert .mat to csv file results in error: matlab

I need to convert a .mat file to csv so that it can be converted to yaml.我需要将 .mat 文件转换为 csv,以便将其转换为 yaml。 I am following this question: http://in.mathworks.com/matlabcentral/answers/195151-how-to-convert-a-mat-file-into-a-csv-file我正在关注这个问题: http://in.mathworks.com/matlabcentral/answers/195151-how-to-convert-a-mat-file-into-a-csv-file : http://in.mathworks.com/matlabcentral/answers/195151-how-to-convert-a-mat-file-into-a-csv-file

But after writing those commands matlab is giving this error:但是在编写这些命令后,matlab 出现了这个错误:

??? Reference to non-existent field 'M'.

These are the commands I entered:这些是我输入的命令:

>> FileData = load ('C:\Users\cortana\Desktop\model3Ddlib.mat');
>> csvwrite ('C:\Users\cortana\Desktop\model3Ddlib.csv', FileData.M);

Why is this error coming up and what should I do to remove it?为什么会出现此错误,我该怎么做才能将其删除?

FileData is an struct with the stored .mat variables as fields. FileData是一个结构体,其中存储的 .mat 变量作为字段。

Your .mat doesn't contain an M variable...您的 .mat 不包含M变量...

After loading the .mat write FileData.加载 .mat 后写入FileData. and let autocomplete show you the available fields, or execute fieldnames(FileData)并让自动完成显示可用字段,或执行fieldnames(FileData)

then export to CSV as:然后导出为 CSV 为:

csvwrite ('C:\Users\cortana\Desktop\model3Ddlib.csv', FileData.<your_field_here>);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM