声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2016|回复: 5

[综合讨论] 请问在matlab下如何存取数据

[复制链接]
发表于 2006-12-2 13:27 | 显示全部楼层 |阅读模式

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

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

x
我想知道在matalb下如何存取数据
回复
分享到:

使用道具 举报

发表于 2006-12-2 14:04 | 显示全部楼层
用m文件存在matlab的目录下
发表于 2006-12-2 15:10 | 显示全部楼层
数据的format是什么?
.m or 二进制?
dlmwrite  dlmread 可以完成二进制文件的读取(.txt .dat)
发表于 2006-12-2 15:23 | 显示全部楼层
简单的用 save load
保存为.mat文件
发表于 2006-12-2 22:13 | 显示全部楼层
用save保存,load读取,可以多种格式,见save的在线帮助。
SAVE Save workspace variables to disk.
    SAVE FILENAME saves all workspace variables to the binary "MAT-file"
    named FILENAME.mat.  The data may be retrieved with LOAD.  If FILENAME
    has no extension, .mat is assumed.  

    SAVE, by itself, creates the binary "MAT-file" named 'matlab.mat'.  It
    is an error if 'matlab.mat' is not writable.

    SAVE FILENAME X  saves only X.
    SAVE FILENAME X Y Z  saves X, Y, and Z. The wildcard '*' can be used to
    save only those variables that match a pattern.

    SAVE FILENAME -REGEXP PAT1 PAT2 can be used to save all variables
    matching the specified patterns using regular expressions. For more
    information on using regular expressions, type "doc regexp" at the
    command prompt.

    SAVE FILENAME -STRUCT S saves the fields of the scalar structure S as
    individual variables within the file FILENAME.
    SAVE FILENAME -STRUCT S X Y Z  saves the fields S.X, S.Y and S.Z to
    FILENAME as individual variables X, Y and Z.

    ASCII Options:
    SAVE ... -ASCII  uses 8-digit ASCII form instead of binary regardless
                     of file extension.
    SAVE ... -ASCII -DOUBLE  uses 16-digit ASCII form.
    SAVE ... -ASCII -TABS  delimits with tabs.
    SAVE ... -ASCII -DOUBLE -TABS  16-digit, tab delimited.

    MAT Options:
    SAVE ... -MAT        saves in MAT format regardless of extension.
    SAVE ... -V6         saves a MAT-file that MATLAB 6 can LOAD.
    SAVE ... -V4         saves a MAT-file that MATLAB 4 can LOAD.
    SAVE ... -APPEND     adds the variables to an existing file (MAT-file
                         only).

    By default, MAT-files created with SAVE are compressed and char arrays are
    encoded using Unicode. These MAT-files cannot be loaded into versions of
    MATLAB prior to MATLAB 7.0. The -V6 option disables these features and
    allows saved MAT-files to load into older versions of MATLAB. To disable
    these features by default, modify the settings in the General->MAT-Files
    preferences panel, accessible via the File->Preferences menu item. With
    compression enabled, saving data that does not compress well takes
    longer. In this case, the -V6 option may be preferable.

    When using the -V4 option, variables that are incompatible with MATLAB 4
    are not saved to the MAT-file. For example, ND arrays, structs, cells,
    etc. cannot be saved to a MATLAB 4 MAT-file. Also, variables with names
    that are longer than 19 characters cannot be saved to a MATLAB 4
    MAT-file.

    Use the functional form of SAVE, such as SAVE('filename','var1','var2')
    when the filename or variable names are stored in strings.

    Examples for pattern matching:
        save fname a*                % Save variables starting with "a"
        save fname -regexp ^b\d{3}$  % Save variables starting with "b" and
                                     %    followed by 3 digits
        save fname -regexp \d        % Save variables containing any digits
发表于 2006-12-4 11:48 | 显示全部楼层
具体读什么数据?方法有很多
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-11-19 18:37 , Processed in 0.056021 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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