anyone can help me explain the meaning of the following code?
Mostrar comentarios más antiguos
data = [ 1 100 500; 2 200 600; 3 300 700; 4 400 800 ];
headers = {'ID', 'Population', 'Revenue'};
for i = 1:size(data, 1)
fprintf('%-4d %-12d %-10d\n', data(i, :));
end
4 comentarios
John D'Errico
el 6 de Mayo de 2024
Code by itself has no meaning.
That code takes some numbers, and prints them out in the command window, using formatting. You can infer any meaning you wish from the headers array, which is not actually displayed.
Shwe
el 6 de Mayo de 2024
It defines a loop over i where i runs from 1 to the number of rows of the matrix "data" (the "1" in size(data,1) refers to the first dimension of the matrix "data", thus the number of rows).
Since "data" has 4 rows, the loop runs from 1 to 4.
Shwe
el 6 de Mayo de 2024
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Time Series Events 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!