MATLAB Answers

what does this line mean

3 views (last 30 days)
Matlab works
Matlab works on 26 Feb 2020
Commented: Adam on 26 Feb 2020
t= [ones(1,10) 1+ones(1,10) 2+ones(1,15) 3+ones(1,10) ];

  1 Comment

Sign in to comment.

Answers (1)

Benjamin Großmann
Benjamin Großmann on 26 Feb 2020
ones(r, c) creates an array of ones with r rows and c columns. That said, ones(1, c) creates a line vector with c elements. Here, four line vectors are created and written side by side in one line vector. Therefore, t is a line vector containing 10 ones, 10 twos, 15 threes and 10 fours.


Sign in to comment.

Sign in to answer this question.


Translated by