필터 지우기
필터 지우기

How to fill array of zeros with string

조회 수: 47 (최근 30일)
suleiman abdullahi
suleiman abdullahi 2019년 8월 18일
댓글: suleiman abdullahi 2019년 8월 18일
Hello,
I have the following code in which i want to fill the preallocated x with strings instead of number, i reason like this
x = zeros(5,1);
for k =1:length(x)
x(k) = {'load'};
end
x
but i get this error >> Conversion to double from cell is not possible.
Error in weather (line 60)
x(k) = {'load'};
Your help is much appreciated.

채택된 답변

Bruno Luong
Bruno Luong 2019년 8월 18일
x = cell(5,1);
for k =1:length(x)
x(k) = {'load'};
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by