
 %choice2 = menu('pick','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a') 
disp('Choose a database to edit')
choice1=menu('Pick a database to add to','Mass Balances','Mass & Energy Balances','Your previous database');
if choice1 == 1
load struct3
elseif choice1 == 2
%load struct4
disp('The program has not been updated to add to this database, sorry!');
break
elseif choice1 == 3
snm=input('Enter the name of your structure to add to: ','s');
load (snm)
end


flds=fieldnames(stdat2);
[nrowf,ncolf]=size(flds);
 [nrows,ncols]=size(stdat2);
newcol = ncols + 1;

stdat2(newcol).cnms = ' ';
stdat2(newcol).form = ' ';
for m=3:nrowf
stdat2 = setfield(stdat2,{newcol},flds{m}, NaN );
end

choice2=0;

while choice2 ~= 1

choice2 = menu('Choose','Finished','CNMS','FORM','MW');

if choice2 == 1
break
elseif choice2 == 2
name=input('Enter the common name of the compound: ','s');
stdat2(newcol).cnms = name;
elseif choice2 == 3
formula=input('Enter the formula of the compound: ','s');
stdat2(newcol).form = formula;
elseif choice2 == 4
weights = input('Enter the weight of the compound: ');
stdat2(newcol).mw = weights;
end
end

%ame=input('Enter the common name of the compound: ','s');
%ormula=input('Enter the formula of the compound: ','s');
%tdat2(newcol).cnms = name;
%tdat2(newcol).form = formula;

%or m=3:nrowf
%emp=input(['Enter data for ',flds{m},': ']);
%tdat2 = setfield(stdat2,{newcol},flds{m},temp);
%nd

if choice1 == 3
eval (['save ', snm, ' stdat2'])
disp(['The updated structure has been saved as: ',snm]);
else
file=input('Enter the name of your structure: ','s');
eval(['save ',file,' stdat2'])
end

clear all
