% example of how to extract variables from a structure into main memory 
% this converts a 1 level deep struct
% e.g. will return 'temp=str.temp; sal=str.sal;' (etc.)
% not a function

debug=1;
mycmd=[]; myvnames=[];

myfno=fieldnames(mystruct);
for i=1:length(myfno)
    field_name=myfno{i};
    myvnames=[myvnames ' ' field_name];
    mycmd=[mycmd ' ' field_name ' =  mystruct.' field_name '; ' ];

end
if debug ==1,
    fprintf('%s \n',mycmd); end
eval(mycmd);

