multiple a vector by a scalar using dot error
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
DGM
le 29 Juil 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 commentaires
Voir également
Catégories
En savoir plus sur Whos dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!