Engineering arrays zybooks problem
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nathan
am 15 Sep. 2022
Beantwortet: Souvik Das
am 22 Sep. 2022
function dailyMaterialSum = MaterialSum (weightArray)
% Write a function that sums the elements of the weightArray
% and prints the result to 2 decimal points
dailyMaterialSum = fprintf ('%.2f',(MaterialSum (weightArray)))
end
0 Kommentare
Akzeptierte Antwort
Souvik Das
am 22 Sep. 2022
The code below sums up the elements of the array and displays the result upto 2 decimal places.
function dailyMaterialSum = MaterialSum (weightArray)
% Write a function that sums the elements of the weightArray
% and prints the result to 2 decimal points
dailyMaterialSum = sum(weightArray);
fprintf('%.2f',dailyMaterialSum);
end
Also please follow the link below for the round function which might be useful too.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!