필터 지우기
필터 지우기

How to collect non-integers from for loop in one matrix?

조회 수: 2 (최근 30일)
Aditya Palsule
Aditya Palsule 2015년 7월 1일
댓글: Jan 2015년 7월 1일
eg: for k=1:.5:10 y(k)=[k] end
this wont work i need output as y=1 1.5 2 2.5 and so on.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 1일
편집: Azzi Abdelmalek 2015년 7월 1일
ii=0;
for k=1:.5:10
ii=ii+1
y(ii)=k
end
or
k=1:.5:10
for ii=1:numel(k)
y(ii)=k(ii)
end

추가 답변 (0개)

카테고리

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