Homework help, displaying a matrix with a loop
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Matthew Covington
am 28 Feb. 2019
Kommentiert: Matthew Covington
am 28 Feb. 2019

Above is how im supposed to get the following output, which is the lake_powell matrix:
Lake Powell Water Levels (in feet)
2013 2014 2015 2016
3594.38 3563.41 3596.26 3601.41
3589.11 3560.35 3591.94 3598.63
3584.49 3557.42 3589.22 3597.85
3583.02 3557.52 3589.94 3599.75
3584.70 3571.60 3598.27 3604.68
3587.01 3598.06 3609.36 3610.94
3583.07 3607.73 3608.79 3609.47
3575.85 3604.96 3604.93 3605.56
3571.07 3602.20 3602.08 3602.27
3570.70 3602.31 3606.12 3601.27
3569.69 3602.65 3607.46 3599.71
3565.73 3600.14 3604.96 3596.79
How would one go about displaying this matrix a row at a time with a loop?
I currently have this code and got the correct output but I am unsure how to diplay it correctly with a loop:
% read data file
lake_powell = load('lake_powell.txt');
% print title and year column headings
column_headings = [2013, 2014, 2015, 2016];
% print contents of lake_powell
fprintf(' Lake Powell Water Levels (in feet)\n')
fprintf(' %d %d %d %d\n', column_headings)
fprintf(' %6.2f %6.2f %6.2f %6.2f\n', lake_powell' )
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices 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!