简体   繁体   English

使用八度音程加载在Matlab中创建的ASCII格式.mat文件

[英]Load with octave created ASCII format .mat file in Matlab

As I am running out of licenses I am using both Matlab and Octave and as long as I keep things simple I haven't had any trouble. 由于我没有使用许可证,我使用Matlab和Octave,只要我保持简单,我就没有遇到任何麻烦。

I recently started using .mat files to decrease my amount of single files. 我最近开始使用.mat文件来减少单个文件的数量。

When I do everything in Matlab it works just fine but when I use 'save' in Octave it saves the file as ASCII and it looks somewhat like this at the beginning and has multiple matrixes in it and so multiple headers. 当我在Matlab中做所有事情时它工作得很好但是当我在Octave中使用'save'时它将文件保存为ASCII,它在开头看起来有点像这样,并且有多个矩阵,因此有多个标题。

# Created by Octave 3.6.4, Mon Feb 24 21:34:39 2014 CET <***@****>
# name: C
# type: matrix
# rows: 10000
# columns: 10
 79 79 79 79 79 79 79 79 79 79
 74 115 87 55 101 46 83 92 113 61
 69 142 128 48 160 45 87 113 114 71
 84 107 145 62 245 78 69 88 149 78
 120 73 148 32 299 114 57 79 137 76

This is fine but Matlab refuses to read the file. 这很好,但Matlab拒绝读取文件。 Neither with 'load' and '-ASCII' nor with importdata. 既没有'load'和'-ASCII'也没有importdata。 (Warning: File contains uninterpretable data....) (警告:文件包含无法解释的数据....)

Is there anything I can do? 有什么我能做的吗? Octave loads the files just fine with 'load'. Octave使用'load'加载文件就好了。

Thanks!! 谢谢!!

In Octave save as "-ascii" or as matlab binary format v4, v6, v7 在Octave中保存为“-ascii”或matlab二进制格式v4,v6,v7

octave:1> a = rand(3, 3)
a =
   0.086093   0.541999   0.889222
   0.029643   0.633532   0.762954
   0.544787   0.150573   0.927285
octave:2> save ("-ascii", "yourfile.asc")
octave:3> save ("-v7", "yourfile.mat")

back in matlab do 回到matlab做

>> b = load ('yourfile.asc')

b =

    0.0861    0.5420    0.8892
    0.0296    0.6335    0.7630
    0.5448    0.1506    0.9273

or 要么

>> load ('yourfile.mat')
>> a

a =

    0.0861    0.5420    0.8892
    0.0296    0.6335    0.7630
    0.5448    0.1506    0.9273

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM