How to save ".txt" to ".mat"?
    1 view (last 30 days)
  
       Show older comments
    
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 Comments
  Stephen23
      
      
 on 25 Aug 2022
				save('RO-2013-equinox.mat','data')
%                          ^    ^ this needs to be the name of a variable
Accepted Answer
  Chunru
      
      
 on 25 Aug 2022
        data=dlmread('RO-2013-equinox.txt');
save('RO-2013-equinox.mat', 'data');        % quote the variable name
0 Comments
More Answers (0)
See Also
Categories
				Find more on Workspace Variables and MAT Files in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

