function deal()
5 ビュー (過去 30 日間)
古いコメントを表示
I'm having trouble getting deal() to place one number in multiple places. My lines of code:
y1=[];
y2=[];
y3=[];
y={y1 y2 y3};
y=deal(5);
gives me the error: The right hand side of this assignment has too few values to satisfy the left hand side.
採用された回答
Matt Fig
2011 年 6 月 6 日
y = cell(1,3); % dispense with the y1, y2, y3 stuff....
[y{:}] = deal(5)
or, without defining the variable first:
[Y{1:3}] = deal(5) % Y is not defined before this line..
But why use DEAL at all?
y = cell(1,3);
y(:) = {9}
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!