📄 sv.m
字号:
function sv(in,filename)
% The function:
%
% sv(in,filename)
%
% saves the variable <in> in the file <filename>.
%
% The optional string <filename> contains the name (and the path)
% of a file to be written in the .dat format.
% If <filename> is not specified, a dialog box is displayed.
%
% See also ld
if nargin<1,
disp('you must specify a variable in arg1');
return;
end;
if nargin<2,
[filename,filepath] = uiputfile('*.dat','sv: Save File As ...');
if filename==0,
return;
else,
filename = strcat(filepath,filename);
end;
end;
[row,col] = size(in);
fid=fopen(filename,'wt');
if fid>=0,
fprintf(fid,'%e\t',col);
fprintf(fid,'%e\t',zeros([1,col-1]));
fprintf(fid,'\n');
fprintf(fid,'%e\t',row);
fprintf(fid,'%e\t',zeros([1,col-1]));
fprintf(fid,'\n');
for i=1:row,
fprintf(fid,'%e\t',in(i,:));
fprintf(fid,'\n');
end;
fclose(fid);
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -