Import of multiple .fig files

3 次查看(过去 30 天)
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));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by