Error using save, too many output arguments - don’t know how to fix.
Mostrar comentarios más antiguos
Hi y’all
I am trying to save multiple tables I’ve edited in matlab, but I get this error:
Error using save
Too many output arguments.
I’m having trouble figuring out how to fix this. The code it’s probably referring to is:
function [output] = save_on_Computer(ReferenceData, month, day)
file_name = "OL_"+month+"_"+day+".csv" ;
savefile = save(file_name) ;
output = savefile ;
endfrom the full code here:
% Pull data from files
function [output] = each_day_table(month, day)
fileNames = sprintf('D2024%02d%02d*.csv', month, day) ;
datastore_result = datastore(fileNames) ;
original_data = readall(datastore_result) ;
output = original_data ;
end % Find Where Equivilant Diamiter > 150 And Remove (ICB measures b/w 2 - 150 μm)
function [output] = remove_150(original)
new = original ;
Greater150 = original.EquivDiameter > 150 ;
new(Greater150, :) = [] ;
output = new ;
end % To Save Each Newly Made File Onto Computer
function [output] = save_on_Computer(ReferenceData, month, day)
file_name = "OL_"+month+"_"+day+".csv" ;
savefile = save(file_name) ;
output = savefile ;
end function [output] = do_everything(year, month, day)
original_data = each_day_table(month, day) ;
data_lessthan_150 = remove_150( original_data) ;
save_to_folder = save_on_Computer(data_without_zeroes, month, day) ;
output = save_on_Computer ; % change data_with_surface_area with data_with_ratio
endOL_06_03 = do_everything (2024,06,03) ; OL_06_04 = do_everything (2024,06,04) ; OL_06_05 = do_everything (2024,06,05) ; OL_06_06 = do_everything (2024,06,06) ;
Respuesta aceptada
Más respuestas (2)
Steven Lord
el 23 de Mzo. de 2025
0 votos
None of the syntaxes listed in the Syntax section of the documentation page of the save function indicate it returns any output. If you tell us what you were hoping that variable would contain we may be able to tell you how to create that variable.
Walter Roberson
el 23 de Mzo. de 2025
save() does not support any output arguments.
You also have the problem that save() with a single input argument will save all of the variables in scope -- including ReferenceData, month, day and file_name
function [output] = save_on_Computer(ReferenceData, month, day)
file_name = "OL_"+month+"_"+day+".csv" ;
save(file_name, 'ReferenceData');
output = file_name ;
end
Categorías
Más información sobre Standard File Formats en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!