How to display the filename correctly?
14 views (last 30 days)
I am trying to export a figure with a file name that is derived from the string name after a section of a code. Below is the export fig part. But for some reason, instead of printing the actual name of string the code prints fig_name as the file name. What can be done to avoid this?
p1 = strfind(fname,'.csv');
fig_name = string(fname(1:1:p1-1));
fig_name = sprintf(fig_name + '.png')
%% export the figure
export_fig fig_name -transparent