📄 bld.m
字号:
function [out,row,col] = bld(filename)
% The function:
%
% [out,row,col] = bld(filename)
%
% loads the file <filename> in the variable <out>.
%
% The optional string <filename> contains the name (and the path)
% of a file written in binary format.
% If <filename> is not specified, a dialog box is displayed.
%
% <row> and <col> are such that [row,col] = size(out)
%
% See also bsv
if nargin<1,
[filename,filepath] = uigetfile('*.dat','bld: Load File');
if filename==0,
out = [];
row = 0;
col = 0;
return;
else,
filename = strcat(filepath,filename);
end;
end;
fid=fopen(filename,'rb');
if fid>=0,
tmp = fread(fid,1,'long');
col = fread(fid,1,'long');
row = fread(fid,1,'long');
tmp = fread(fid,1,'long');
out = fread(fid,row*col,'double');
out = (reshape(out,col,row))';
fclose(fid);
else,
disp(strcat('file <',filename,'> not found!'));
out = 0;
row = 0;
col = 0;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -