Saveas plot using name of imported data file.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Samir
am 13 Jun. 2014
Kommentiert: Samir
am 7 Mär. 2016
I have a data file named ex1.csv that I imported and plotted the data. I want to write a script which save this plot using same file name as input data file.
I have in workspace file name as
filev= 'I:\windows\users\me\desktop\data\ex1.csv'
which is imported some how, now I want to use something like
saveas(gcf,filev,'fig')
So that it saves ex1.fig file to exact same location as that of imported file with same file name and different extension(Ofcourse).
Above command does not work it tries to overwrite same file.
0 Kommentare
Akzeptierte Antwort
Dishant Arora
am 13 Jun. 2014
Bearbeitet: Dishant Arora
am 13 Jun. 2014
[path , name , ext] = fileparts(filev);
saveas(gcf , fullfile(path , [name , '.jpg']))
% You can change the path you want to save in
0 Kommentare
Weitere Antworten (1)
Mischa Kim
am 13 Jun. 2014
Samir, how about
[pathstr,name,ext] = fileparts(filev);
f = fullfile(pathstr,name);
saveas(gcf,f)
Siehe auch
Kategorien
Mehr zu Data Import and Analysis 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!