How to save ".txt" to ".mat"?

2 次查看(过去 30 天)
Ara
Ara 2022-8-25
编辑: Ara 2022-8-25
Dear All,
I have a file ".txt" and I want to save it to ".mat". I used this code and got this error.Please see below.
data=dlmread('RO-2013-equinox.txt');
>> save ('RO-2013-equinox.mat',data);
Error using save
Must be a string scalar or character vector.
I would appriciate to help me.
  2 个评论
Stephen23
Stephen23 2022-8-25
save('RO-2013-equinox.mat','data')
% ^ ^ this needs to be the name of a variable
Ara
Ara 2022-8-25
编辑:Ara 2022-8-25
Thank you. I wish you write in answer so that I can accept it and vote to you.

请先登录,再进行评论。

采纳的回答

Chunru
Chunru 2022-8-25
data=dlmread('RO-2013-equinox.txt');
save('RO-2013-equinox.mat', 'data'); % quote the variable name

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by