Error "too many input arguments"

1 vue (au cours des 30 derniers jours)
Soham Shah
Soham Shah le 3 Mar 2021
Commenté : Soham Shah le 3 Mar 2021
When I run the code below with the input code1([1 3 4]) I get an error that says too many input arguments. I made sure there are no other variables named code1. Any help?
function code2 = code1(z)
z1 = 0;
z2 = 0;
z3 = 0;
code2 = zeros(1,length(z));
for i = 1:length(z)
code2(i) = z(i) + 1;
end
disp ('code2 =', code2)
end

Réponse acceptée

Rik
Rik le 3 Mar 2021
You misread the error message slightly. The source of your issue is here:
disp ('code2 =', code2)
The disp function only allows a single input. You will have to do something else (e.g. with fprintf).
  1 commentaire
Soham Shah
Soham Shah le 3 Mar 2021
oh okay. It worked now, thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands 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!

Translated by