can anyone find the error?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/389693/image.jpeg)
and after RUN
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/389698/image.jpeg)
0 Commenti
Risposta accettata
Sindar
il 23 Ott 2020
Perhaps you are calling the function with two few arguments, such as this on the command line:
quadraticc(2)
If you are simply hitting the "Run" button, then the program assumes no inputs at all, and b happens to be the first one it comes across.
Neither of these are bugs in the code, simply incorrect usage. If you want to prevent this, define defaults:
function quadraticc(a,b,c)
arguments
a (1,1) double = 1
b (1,1) double = 0
c (1,1) double = 0
end
2 Commenti
Vedere anche
Categorie
Scopri di più su Logical 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!