Creating a function with a logical output.
Afficher commentaires plus anciens
Hi all,
I am quite confused. I have a function say like this:
function [output] = TLU( inputs, weights, threshold )
activationMagnitude = sum(weights.*inputs)
if activationMagnitude > threshold
output = true;
else
output = false;
end
But when I use class(ans) it always shows a char data type - despite me specifying the output as either true or false!
Why is this?
Best regards,
Craig
1 commentaire
Azzi Abdelmalek
le 14 Fév 2013
What ans represent?
Réponse acceptée
Plus de réponses (1)
José-Luis
le 14 Fév 2013
It does return logical for me.
What does
class(TLU(rand, rand, rand))
return? If ans returns something different, you may have overwritten its value before you call to class()
1 commentaire
Azzi Abdelmalek
le 14 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 14 Fév 2013
The question is what ans represent?
Catégories
En savoir plus sur Language Support dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!