Error "Size input must be scalar"
2 ビュー (過去 30 日間)
古いコメントを表示
Sir, Here delu=randi(30,1), in which i want to add zeros(3,1) but when i am running this in my complete code it is showing "Size input must be scalar".
Please help me out with it.
delu=randi(30,1);
delU=([zeros(3,1);delu]);
1 件のコメント
Rik
2022 年 9 月 27 日
編集済み: Image Analyst
2022 年 9 月 27 日
Your code runs without error, as you can see.
delu=randi(30,1);
delU=([zeros(3,1);delu])
回答 (1 件)
Image Analyst
2022 年 9 月 27 日
MATLAB is case sensitive so delu is different than delU. Try this:
delu=randi(30,1) % Generate a single integer in the range 1-30
delu=([zeros(3,1);delu]) % Prepend 3 zeros above that number so it's now 4 rows tall.
whos delu
2 件のコメント
Image Analyst
2022 年 9 月 27 日
編集済み: Image Analyst
2022 年 9 月 27 日
OK but it still works, you just have two variables with extremely similar spelling, which of course will be very confusing:
delu=randi(30,1) % Generate a single integer in the range 1-30
delU=([zeros(3,1);delu]) % Prepend 3 zeros above that number so it's now 4 rows tall.
whos delU
So why isn't it working for you? You are not even calling the size() function like the error says. You need to give us ALL your code.
参考
カテゴリ
Help Center および File Exchange で C Code Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!