I am attempting to append either a cell or structure to a file, I have tried both, to either an .xlsx or .mat file, I have tried both.
data = uigetfile('*.mat');s = load(data);date = regexp(data, '\d+_\d+', 'match');file = (s.details);% Comment on data
comment = 'NaN';% Create cell
IAMHS_f = [date comment file(1,1) file(1,2) file(1,3) file(1,4)];% Create stucture
% headings = {'Date' 'Comments' 'Mean' 'Min' 'Max' 'Std'};
% IAMHS_f2 = cell2struct(IAMHS_f,headings, 2)
%%Save and append parameter
savdir = 'C:\Users\Tim\Documents\AI-LLC\DATA\2ndary\DailyDetails\FinalPlots'save(fullfile(savdir,'IAMHS.mat'),'IAMHS_f','-append')
The files I have tried appending are empty .mat and .xlsx files. When I do so I get (Error using save, File may be corrupt)
I have also tried saving one set of data first and then doing an append feature and it appears like it overwrites the existing data. I would prefer to be able to save the first set of data without having to make any adjustments to my code to append it.
I essentially have a 1×6 (cell or structure) and want to save it and continue adding rows.
Best Answer