multiple a vector by a scalar using dot error
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
DGM
on 29 Jul 2021
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 Comments
See Also
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!