Unable to store function output in an other variable
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Muhammad Burhan Maqbool
le 2 Mar 2015
Commenté : Muhammad Burhan Maqbool
le 2 Mar 2015
I created a function to convert a degree value to radian. The function works fine and executed on command prompt. However, when I try to store the output of that function in to a variable, I get ' Too many output arguments error ' .
Below I am pasting the code of function:
function d2r(x) (x.*pi)./180
Above works fine
but doing below gives error
>> clear all >> a = d2r(45) Error using d2r Too many output arguments.
0 commentaires
Réponse acceptée
Julia
le 2 Mar 2015
Hi,
if you want to have an output you have to change your script:
function out = d2r(x)
out = (x.*pi)./180
Now you should be able to call
a = d2r(45)
without error
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown 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!