MATLAB: How to save the varname contains different characters (attached) as a cell array format using GUI in matlab

cellvariable

Below is the code displaying the variables inside the loop. How to save these displayed variables as a cell format using GUI in matlab?
for varid=0:nvars-1
[varname, xtype(i,:), dimids, numatts(i,:)] = netcdf.inqVar(ncid(i,:),varid);
disp(['--------------------< ' varname ' >---------------------'])
end

Best Answer

for varid=0:nvars-1
[varname, xtype(i,:), dimids, numatts(i,:)] = netcdf.inqVar(ncid(i,:),varid);
outstring{varid+1} = ['--------------------< ' varname ' >---------------------']);
end
[outfile, outpath] = uiputfile('*.mat');
if ischar(outfile)
%if the user did not cancel
filename = fullfile(outpath, outfile);
save(filename, 'outstring');
end