How to open multiple fig files at once through code?

34 Ansichten (letzte 30 Tage)
Marine Sachel
Marine Sachel am 23 Mai 2018
Kommentiert: KSSV am 31 Mai 2018
%I need to open multiple files from a directory. I tried using the following code:
[figures, pathname,]=uigetfile('directory','*.fig','Multiselect','on');
for x = 1:length(figures)
Multi_Figs = figures(x).name;
Op = openfig(Multi_Figs);
end
It gave an error,
Error in Multi_Figs = figures(x).name; : Struct contents reference from a non-struct array object.
I tried removing " .name " from it and modified the code as:
[figures, pathname,]=uigetfile('directory','*.fig','Multiselect','on');
for x = 1:length(figures)
Multi_Figs = figures(x);
Op = openfig(Multi_Figs);
end
After running the code it gave another error;
Error in Op = openfig(Multi_Figs); : The value of 'Filename' is invalid. It must satisfy the function: ischar.
I converted the figure names to char by ch=char(figures) and using 'ch' in place of 'figures' in the code. But it also did not work out.
Kindly help me with opening multiple fig files at once.

Antworten (1)

KSSV
KSSV am 23 Mai 2018
Bearbeitet: KSSV am 31 Mai 2018
[figures, pathname,]=uigetfile('directory','*.fig','Multiselect','on');
for x = 1:length(figures)
Multi_Figs = [pathname,filesep,figures{x}];
Op = openfig(Multi_Figs);
end
  5 Kommentare
Marine Sachel
Marine Sachel am 31 Mai 2018
Any other thing I am missing out?
KSSV
KSSV am 31 Mai 2018
Edited the code....try now....

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu File Operations 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