声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2556|回复: 12

[编程技巧] mat 文件为何无法打开

[复制链接]
发表于 2008-4-30 22:33 | 显示全部楼层 |阅读模式

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

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

x
filename 为 B007.0.mat  放在work文件夹中
在MATLAB 中用load 命令时会出现以下内容

>> load B007.0.mat
??? Error using ==> load
Can't read file.

附件中有这个文件,希望高手能帮小弟打开,小弟在此谢谢了

[ 本帖最后由 eight 于 2008-4-30 23:25 编辑 ]

B007.0.mat

36 KB, 下载次数: 23

回复
分享到:

使用道具 举报

发表于 2008-4-30 22:53 | 显示全部楼层
原帖由 wwww_ww 于 2008-4-30 22:33 发表
filename 为 B007.0.mat  放在work文件夹中
在MATLAB 中用load 命令时会出现以下内容

>> load B007.0.mat
??? Error using ==> load
Can't read file.

附件中有这个文件,希望高手能帮小弟打开,小弟在此谢 ...


文件里面的东西好像是乱码呀?
 楼主| 发表于 2008-4-30 23:06 | 显示全部楼层
是吗? 我的老师下午给我的,应该不会吧,你打开了吗
 楼主| 发表于 2008-4-30 23:09 | 显示全部楼层
对了我用的是Matlab 6.5  你用的是什么版本
发表于 2008-4-30 23:16 | 显示全部楼层
原帖由 wwww_ww 于 2008-4-30 23:09 发表
对了我用的是Matlab 6.5  你用的是什么版本


我用的是Matlab R2008a
直接打开时出现乱码,另外我用fscanf命令读取时,也只出现了几个字母
不知道打开的方式正确不?
 楼主| 发表于 2008-4-30 23:20 | 显示全部楼层
我查了一下,这个文件是2000年保存的,那个时候好像就有5.3版的,不知道是不是跟版本有关?
发表于 2008-4-30 23:26 | 显示全部楼层
原帖由 wwww_ww 于 2008-4-30 23:20 发表
我查了一下,这个文件是2000年保存的,那个时候好像就有5.3版的,不知道是不是跟版本有关?
建议先修改一下文件名,如果仍然解决不到,那有可能是版本问题,不过一般来说matlab是向下兼容的,至于如何打开低版本的mat文件,建议help load

评分

1

查看全部评分

 楼主| 发表于 2008-4-30 23:29 | 显示全部楼层
文件名修改过了,也不行。help load ,我也看了。全是英文,看不懂。
>> help load

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
发表于 2008-4-30 23:34 | 显示全部楼层
eight院长说的有道理,最新版本的软件可以打开以前版本存储的文件,要不你装一个5.3的版本试试看能不能打开
 楼主| 发表于 2008-4-30 23:43 | 显示全部楼层
我正在下5.3呢,不过寝室快熄灯了,明天才能试一下。感谢两位的帮助
发表于 2008-5-1 14:07 | 显示全部楼层
十有八九是因为版本的问题,换一个版本应该可以。
发表于 2008-5-4 13:56 | 显示全部楼层
你输入load命令时默认的路径是在work库中,你需要在load命令中加入你的mat文件所在的路径名才行啊
发表于 2008-5-4 14:14 | 显示全部楼层
版本不同,可能造成mat文件无法读取。以后可以存成dat格式。

评分

1

查看全部评分

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-9-23 11:16 , Processed in 0.074949 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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