mat-file

How do you open .mat files in Octave?

痴心易碎 提交于 2019-11-30 08:28:55
I have a ".mat" file that I want to open and see the contents of. Since I don't have MATLAB, I downloaded GNU's Octave. Since I'm working on Mac's TERMINAL, I'm not exactly sure how to open the ".mat" file so that I can see the contents. Can anyone help me with this? Thanks! Not sure which version of .mat file you might have, or whether Octave keeps up with the latest Matlab formats. Here's a link that might be a good start . Bottom line is that you can say: load MyMatFile.mat right at the Octave prompt. In case you wind up having to write code to read the .mat file ever: I've done this before

Saving and loading Python dict with savemat results in error

徘徊边缘 提交于 2019-11-30 07:11:47
Here is an minimal example of the error I get. If I understood the documentation correctly, this should be working, but it seems I did not. a={} a['test1']=1 a['test2']=2 a['test3']=3 import scipy.io as io io.savemat('temp',{'a':a}) b = io.loadmat('temp') b['a'].keys() Traceback (most recent call last): File "<input>", line 1, in <module> AttributeError: 'numpy.ndarray' object has no attribute 'keys' You seem to be operating under the assumption that scipy.io.savemat is intended to be able to save a standard dictionary. I don't believe that is the case. The dictionary argument holds the names

MATLAB: Saving several variables to “-v7.3” (HDF5) .mat-files seems to be faster when using the “-append” flag. How come?

不羁岁月 提交于 2019-11-30 06:59:19
NOTE: This question deals with an issue observed back in 2011 with an old MATLAB version (R2009a). As per the update below from July 2016, the issue/bug in MATLAB seems to no longer exist (tested with R2016a; scroll down to end of question to see update). I am using MATLAB R2009b and I need to write a larger script that converts the contents of a larger set of .zip files to v7.3 mat files (with an underlying HDF5-datamodel). Reading is OK. The issue is with saving. And there is actually no problem. My files saves nicely using the save command. My question is more in the sense: Why am I

Matlab API reading .mat file from c++, using STL container

…衆ロ難τιáo~ 提交于 2019-11-30 04:07:50
I have to read some .mat data files from c++, I read through the documentation, but I would like to know how to handle the data in a clean and elegant way, e.g. using std:vector(modest .mat file size(10M~1G), but memory issues should be taken seriously) My function is sth like: #include <stdio.h> #include "mat.h" #include <vector> int matread(const char *file, const vector<double>& pdata_v) { MATFile *pmat; pmat=matOpen("data.mat","r"); if (pmat == NULL) { printf("Error opening file %s\n", file); return(1); } mxArray *pdata = matGetVariable(pmat, "LocalDouble"); // pdata -> pdata_v mxDestroy

How do you open .mat files in Octave?

不打扰是莪最后的温柔 提交于 2019-11-29 12:00:57
问题 I have a ".mat" file that I want to open and see the contents of. Since I don't have MATLAB, I downloaded GNU's Octave. Since I'm working on Mac's TERMINAL, I'm not exactly sure how to open the ".mat" file so that I can see the contents. Can anyone help me with this? Thanks! 回答1: Not sure which version of .mat file you might have, or whether Octave keeps up with the latest Matlab formats. Here's a link that might be a good start. Bottom line is that you can say: load MyMatFile.mat right at

MATLAB: Saving several variables to “-v7.3” (HDF5) .mat-files seems to be faster when using the “-append” flag. How come?

那年仲夏 提交于 2019-11-29 09:25:33
问题 NOTE: This question deals with an issue observed back in 2011 with an old MATLAB version (R2009a). As per the update below from July 2016, the issue/bug in MATLAB seems to no longer exist (tested with R2016a; scroll down to end of question to see update). I am using MATLAB R2009b and I need to write a larger script that converts the contents of a larger set of .zip files to v7.3 mat files (with an underlying HDF5-datamodel). Reading is OK. The issue is with saving. And there is actually no

Saving and loading Python dict with savemat results in error

╄→尐↘猪︶ㄣ 提交于 2019-11-29 08:54:27
问题 Here is an minimal example of the error I get. If I understood the documentation correctly, this should be working, but it seems I did not. a={} a['test1']=1 a['test2']=2 a['test3']=3 import scipy.io as io io.savemat('temp',{'a':a}) b = io.loadmat('temp') b['a'].keys() Traceback (most recent call last): File "<input>", line 1, in <module> AttributeError: 'numpy.ndarray' object has no attribute 'keys' 回答1: You seem to be operating under the assumption that scipy.io.savemat is intended to be

How can I load part of a .mat file that is too big in memory for my machine?

纵饮孤独 提交于 2019-11-29 04:16:43
I have a big .mat file that I want to process, but it is too big to fit in a single load. I thought to load it in parts, each time to access just the important parameters. So I have practically two questions: How can I access the variables names of the mat file without loading it? How can I load only one of them to the workspace? Thanks! you can see the list of variables using: vars = whos('-file','name.mat'); and then just load the variable you want, say the first one on the list, by: load('name.mat', vars(1).name) As well as loading individual variables from the .mat file as suggested by

Matlab API reading .mat file from c++, using STL container

ぐ巨炮叔叔 提交于 2019-11-29 01:56:51
问题 I have to read some .mat data files from c++, I read through the documentation, but I would like to know how to handle the data in a clean and elegant way, e.g. using std:vector(modest .mat file size(10M~1G), but memory issues should be taken seriously) My function is sth like: #include <stdio.h> #include "mat.h" #include <vector> int matread(const char *file, const vector<double>& pdata_v) { MATFile *pmat; pmat=matOpen("data.mat","r"); if (pmat == NULL) { printf("Error opening file %s\n",

How can I load large files (~150MB) in MATLAB?

心不动则不痛 提交于 2019-11-28 07:46:46
I have a large MATLAB file (150MB) in matrix form (i.e. 4070x4070). I need to work on this file in MATLAB but I can't seem to load this file. I am getting an "out of memory" error. Is there any other way I can load this size of file? I am using a 32bit processor and have 2GB of RAM. Please help me, I am getting exhausted from dealing with this problem. Starting from release R2011b (ver.7.13) there is a new object matlab.io.MatFile with MATFILE as a constructor. It allows to load and save parts of variables in MAT-files. See the documentation for more details. Here is a simple example to read