声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 21636|回复: 7

[编程技巧] matlab中load命令的用法是什么的?

[复制链接]
发表于 2006-9-7 08:32 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
matlab中load命令的用法是什么的?
回复
分享到:

使用道具 举报

发表于 2006-9-7 09:01 | 显示全部楼层
LOAD Load workspace variables from disk.
   LOAD FILENAME retrieves all variables from a file given a full pathname
   or a MATLABPATH relative partial pathname (see PARTIALPATH).  If FILENAME
   has no extension LOAD looks for FILENAME and FILENAME.mat and treats it
   as a binary "MAT-file". If FILENAME has an extension other than .mat, it
   is treated as ASCII.

   LOAD, by itself, uses the binary "MAT-file" named 'matlab.mat'.  It is
   an error if 'matlab.mat' is not found.

   LOAD FILENAME X loads only X.
   LOAD FILENAME X Y Z ... loads just the specified variables.  The
   wildcard '*' loads variables that match a pattern (MAT-file only).

   LOAD -ASCII FILENAME or LOAD -MAT FILENAME forces LOAD to treat the file
   as either an ASCII file or a MAT file regardless of file extension.  With
   -ASCII, LOAD will error if the file is not numeric text.  With -MAT, LOAD
   will error if the file is not a MAT file generated by SAVE -MAT.

   If FILENAME is a MAT file, requested variables from FILENAME are created
   in the workspace. If FILENAME is not a MAT file, a double precision array
   is created with name based on FILENAME.  Leading underscores or digits in
   FILENAME are replaced with X.  Other non-alpha chars in FILENAME are
   replaced with underscores.

   S = LOAD(...) returns the contents of FILENAME in variable S.  If
   FILENAME is a MAT file, S is a struct containing fields matching the
   variables retrieved.  If FILENAME is an ASCII file, S is a double
   precision array.

   Use the functional form of LOAD, such as LOAD('filename'), when the
   file name is stored in a string, when an output argument is requested,
   or if FILENAME contains spaces.

   See also SAVE, WHOS, UILOAD, SPCONVERT, PARTIALPATH, IOFUN, FILEFORMATS.

  Overloaded methods
   help activex/load.m

Overloaded methods
    help ccshelp/load.m
    help mdevproject/load.m
    help cgproject/load.m
    help xpc/load.m
发表于 2006-9-7 09:05 | 显示全部楼层
如果数据格式是XXXX.mat ,可以直接 load XXXX;
如果文本格式XXXX.txt,也可以用load载入,load 'XXXX.txt';
另外文本格式也可以通过Import data转换成.mat格式,matlab默认处理.mat格式数据!
发表于 2006-9-7 09:06 | 显示全部楼层
例:a=load('filename.txt');
filename.txt 存数据的文本文件,在当前路径/一般指在work文件夹下.
运行后a中的数据即为文件中的数据.
上面的英文帮助是最全的.
 楼主| 发表于 2006-9-7 16:00 | 显示全部楼层
谢谢!
发表于 2007-12-27 10:53 | 显示全部楼层
我的mat 文件是一个矩阵,load 进去后,怎么不是矩阵格式
是个struct格式.
这是怎么回事啊??

如图
2.jpg
1.jpg
发表于 2007-12-27 10:56 | 显示全部楼层

看 写给学习 matlab 的新手们 这个精华帖
发表于 2007-12-27 11:40 | 显示全部楼层

回复 #7 eight 的帖子

刚刚没搜到:@L
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-12-5 11:03 , Processed in 0.059119 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表