필터 지우기
필터 지우기

added different number of column using for loop

조회 수: 2 (최근 30일)
Saiem Solimullah
Saiem Solimullah 2018년 6월 5일
댓글: Paolo 2018년 6월 7일
How to add or multiply two different size of array using the loop iteration process? suppose ,an array
a=[1 2 3 4 5 6 7 8 9 ]
b=[1 2]
and i want increase the size of the 'b' array using. for loop. as like the value of 'b' after using for loop is
= [1 2 1 2 1 2 1 2 1]
Then, we will add or multiply this array.That will very much appreciating if anyone can give a matlab code for this problem....

답변 (1개)

Stephen23
Stephen23 2018년 6월 5일
>> c = repmat(b,1,ceil(numel(a)/numel(b)));
>> c = c(1:numel(a))
c =
1 2 1 2 1 2 1 2 1
  댓글 수: 2
Saiem Solimullah
Saiem Solimullah 2018년 6월 7일
matlab 14 doesnt have the "repmat" function...
Paolo
Paolo 2018년 6월 7일
The documentation page for repmat indicates that it was introduced before R2006a.

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

카테고리

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