필터 지우기
필터 지우기

Import of multiple .fig files

조회 수: 3 (최근 30일)
Georgiy
Georgiy 2014년 8월 19일
댓글: Georgiy 2014년 8월 19일
Hello, I have .fig file I want to import and extract a data from it in MATLAB. This is my code:
open('f1.fig');
h = findobj(gca,'Type','line')
x=get(h,'Xdata')
y=get(h,'Ydata')
Channel_1 = y{2,1};
Channel_2 = y{3,1};
At this step, I have Channel_1 and Channel_2 arrays with data of f1.fig. All is working just fine. Here is the problem: I have multiple .fig files I want to import in order to extract data from each one of them, one by one, and combine the data together into overall arrays. I stacked at the import step. My code is:
number_of_figures = 20;
for n=1:number_of_figures
open('f%d.fig', n);
h = findobj(gca,'Type','line')
x = get(h,'Xdata')
y = get(h,'Ydata')
Channel_1 = y{2,1};
Channel_2 = y{3,1};
for i=1:2048
CH1(i+(n-1)*2048) = Channel_1(i); %combining data of all figures into CH1 array
CH2(i+(n-1)*2048) = Channel_2(i); %combining data of all figures into CH2 array
end
end
But it gives the error "Error using open. Too many input arguments." I tried %d, %s, %c - same result. Can someone tell me, how can I import these .fig files in a right way? Thanks in advance, Georgiy.

채택된 답변

Guillaume
Guillaume 2014년 8월 19일
편집: Guillaume 2014년 8월 19일
Not sure why you think open takes a format string. You're missing an sprintf:
open(sprintf('f%d.fig', n));
  댓글 수: 1
Georgiy
Georgiy 2014년 8월 19일
Thanks! It works!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by