multiple a vector by a scalar using dot error
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
DGM
il 29 Lug 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 Commenti
Vedere anche
Categorie
Scopri di più su Whos in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!