I want to save the value of a variable from MATLAB command history in a text. I am trying the command:
Save([d:/work/abc.txt], 'z1', '-ASCII');
An error appears
Error: input charecter is not valid in MATLAB environment or expression.
You should use save
(with lower case for "s").
Also the filename should be defined as a string: enclose it withi two '; also you do not need the []
unless, for example, you want to build a string using a variable and / or any function to create part of the filename (eg
['d:/work/abc_' num2str(k) '.txt']
assuming k
value is 3
) to get d:/work/abc_3.txt
Try change your code to:
save(['d:/work/abc.txt'], 'z1', '-ASCII');
Hope this helps.
Qapla
您所缺少的是括号内用于表示字符串的引号。
['string']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.