Filter löschen
Filter löschen

how to make matrix

2 Ansichten (letzte 30 Tage)
poppy
poppy am 25 Nov. 2022
Beantwortet: Walter Roberson am 26 Nov. 2022
F = zeros(20,1);
F(1:4) = 3.3;
F(5:7) = 4.2;
F(8:10) = 1.8;
F(11:13) = 6.9;
F(14:17) = 4.3;
F(18:20) = 4.1;
how do i take these and put it into the matrix
  3 Kommentare
John D'Errico
John D'Errico am 26 Nov. 2022
Those numbers are already in a matrix, a 20x1 matrix, usually called a vector, but still a matrix too. So exactly what do you want?
poppy
poppy am 26 Nov. 2022
well I would like to display al lthose numbers from 1-20 using fprintf or a table how would I go about doing that?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 26 Nov. 2022
F = zeros(20,1);
F(1:4) = 3.3;
F(5:7) = 4.2;
F(8:10) = 1.8;
F(11:13) = 6.9;
F(14:17) = 4.3;
F(18:20) = 4.1;
table(F)
ans = 20×1 table
F ___ 3.3 3.3 3.3 3.3 4.2 4.2 4.2 1.8 1.8 1.8 6.9 6.9 6.9 4.3 4.3 4.3
fprintf('%.1f\n', F)
3.3 3.3 3.3 3.3 4.2 4.2 4.2 1.8 1.8 1.8 6.9 6.9 6.9 4.3 4.3 4.3 4.3 4.1 4.1 4.1

Tags

Produkte


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by