store values in a zeros matrix without using for loop

조회 수: 5 (최근 30일)
Anvinder
Anvinder 2016년 4월 8일
댓글: Stephen23 2016년 4월 8일
Hi, I have 11 discrete values and i would like to save them in a zeros matrix i=zeros (1,11) one by one manually. I mean i perform some operations and receive the resultant in the form of those values and i would then like to save them in the matrix. There is no for loop involved, how do i do it ? Seems like all the help articles have the for loop.
  댓글 수: 5
dpb
dpb 2016년 4월 8일
Or,
i=[a b c d ...];
But, it's probably a bad_idea(tm) to create all these variables if this is the end result; use the array or alternate way to create them to begin with so you don't have to write such code.
Stephen23
Stephen23 2016년 4월 8일
Put all of the values in one variable to begin with. This will be much simpler than anything else.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 4월 8일
i(1) = 73.1
i(2) = 19.8
i(3) = sin(3/4)
...

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by