필터 지우기
필터 지우기

Saving Structure leads to error "Index exceeds matrix dimensions."

조회 수: 1 (최근 30일)
Aron
Aron 2014년 8월 27일
댓글: Aron 2014년 8월 27일
Hello everyone,
I have two different structures (DATA and orient). They both are build up like this: DATA.S(1).M(1).A(1).var1 etc...
When I want to save them with the following lines:
text='data1';
filename=strcat('save/',text,'.mat');
save(filename, 'DATA', 'orient');
I get the error "Index exceeds matrix dimensions." for the save line.
When I stop the Programm before the line and try to save it manually over the Workspace matlab is crashing but using all the processing power.
I'm using MAtlab R2014a an the structs are between 2000-4000Bytes.
I hope anyone has a idea what it could be about. Thanks for your help!
  댓글 수: 1
Aron
Aron 2014년 8월 27일
Ok, I found a solution. I simply used the following code(<http://www.mathworks.com/matlabcentral/fileexchange/39721-save-mat-files-more-quickly/content/savefast.m>) from Tim Holy. Now it works without any problems. Thanks Tim Holy!!! :)

댓글을 달려면 로그인하십시오.

답변 (1개)

Amir
Amir 2014년 8월 27일
I think the main issue in your code is related to the filename. The filename cannot have "/". Use another separator instead.
  댓글 수: 1
Aron
Aron 2014년 8월 27일
I just changed it to filename=strcat(text,'.mat'); but I still get the error :/ But thank you!
I was using the "/" to save it in the folder "save" that is already existing. Is there an other way to do that?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by