20200815 simulink波形导出为CSV文件

https://www.mathworks.com/help/matlab/ref/writematrix.html
在这里插入图片描述
首先就不知道到底该是array还是timeseries,貌似array是横着增加的,timeseries是竖着增加的
https://www.mathworks.com/matlabcentral/answers/3644-how-can-i-save-data-to-a-csv-file-from-a-simulation-in-simulink-without-use-the-matlab-workspace
csvwrite(’test.csv’,ScopeData5) dlmwrite(’test.csv’, ScopeData5, ’;’) dlmwrite(’test.txt’, ScopeData5, ’;’)
在这里插入图片描述
但是报错:

>> csvwrite('test.csv',ScopeData415V) 
错误使用 csvwrite (line 47)
未定义与 'struct' 类型的输入参数相对应的函数 'real'

https://itectec.com/matlab/matlab-mat-to-csv/

Well, your lbp cell array has a vector in each cell! Anyway, I'd prefer to create a table and then use writetable function like the following.
C = [Entropy feature lbp Mean name];
T = cell2table(C(2:end,:),'v',C(1,:));
writetable(T,'dummy1.csv')

 
Related Question
How to convert a .mat file into a .csv file
Import loop for a files in a folder
How to convert a .mat file into tab separated .txt file
Is there a Row limit when transfering a matlab table to CSV file
Csvread: Trouble reading ‘Numeric’ field from file

https://stackoverrun.com/cn/q/8624729

我在网上查找并完成以下操作将.mat文件转换为.csv文件,但我一直在看到一个错误。这是我已经试过:

FileData = load('mydata.mat'); 
csvwrite('weights.csv', FileData); 
不过,我总是看到在MATLAB以下错误:

Undefined function 'real' for input arguments of type 'struct'. 

Error in dlmwrite (line 189) 
        str = sprintf('%.*g%+.*gi',precn,real(m(i,j)),precn,imag(m(i,j))); 

Error in csvwrite (line 42) 
dlmwrite(filename, m, ',', r, c); 

csvwrite使用矩阵,而不是结构。您需要先将结构转换为矩阵。您也可以使用T = struct2table(FileData)然后可写(T,'myData.csv''Delimiter'),然后用T = struct2table(FileData)创建一个新的数组。 ','

https://www.youtube.com/watch?v=mCJNuH5PdoU
在这里插入图片描述
这个视频把save to file的time格式为timeseries,data格式为array
在这里插入图片描述
虽然CSV文件是excel样式的,但是写字板打开还是个带,的txt

示波器 load to data,然后time structure
直接复制矩阵中的整列,然后放到excel里,然后另存为csv即可

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页