How should I solve "ranges for MatFile objects must increase in equally spaced intervals"?

9 ビュー (過去 30 日間)
Xiaoliang Tang
Xiaoliang Tang 2017 年 8 月 26 日
回答済み: Image Analyst 2017 年 8 月 26 日
I want to read some specific rows from a large data file (a large matrix in .mat format). The codes are as follows
m = matfile('data_file.mat'); % a N*D matrix data is stored in 'data_file.mat'
xx = m.data([1,3,4,6,9],:);
The error alert is "Cannot index into 'data' because ranges for MatFile objects must increase in equally spaced intervals". Is there any solution to this problem?

回答 (1 件)

Image Analyst
Image Analyst 2017 年 8 月 26 日
You forgot to attach your .mat file so we can't try your code. But try breaking it up into two lines
% Extract 2-D matrix into xx
xx = m.data;
% Now extract only specified rows.
xx = xx([1,3,4,6,9],:);

カテゴリ

Help Center および File Exchange工作区变量和 MAT 文件 についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!