bld.m

来自「用matlab实现利用统计混沌方法解决非线性系统时间序列预测的问题」· M 代码 · 共 42 行

M
42
字号
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 + =
减小字号Ctrl + -
显示快捷键?