multiple a vector by a scalar using dot error
조회 수: 3 (최근 30일)
이전 댓글 표시
So yet another problem for my day
I am trying to multiply a simple cell array fill of ints by a scalar value
if i print out
my_array{1:end , 1}
I get a bunch of ints back
However if i say
my_array{1:end , 1} * 5
I get a "too many input arguments" error from matlab
One would assume you need element wise multiplication here
So i resort to
my_array{1:end , 1} .* 5
And guess what, same error
too many input arguments
How is that even possible?
Suggestions?
댓글 수: 0
답변 (1개)
DGM
2021년 7월 29일
I guess I already mentioned this, but
A = num2cell(reshape(1:70,10,[]))
A{2:2:end,7} % this expression has multiple outputs (multiple scalars)
vertcat(A{2:2:end,7}) % this expression has only one output (a vector)
vertcat(A{2:2:end,7}) * 2 % this works
A{2:2:end,7} * 2 % this doesn't
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!