Filter löschen
Filter löschen

Import of multiple .fig files

1 Ansicht (letzte 30 Tage)
Georgiy
Georgiy am 19 Aug. 2014
Kommentiert: Georgiy am 19 Aug. 2014
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.

Akzeptierte Antwort

Guillaume
Guillaume am 19 Aug. 2014
Bearbeitet: Guillaume am 19 Aug. 2014
Not sure why you think open takes a format string. You're missing an sprintf:
open(sprintf('f%d.fig', n));

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by