Keep the mailing list in CC. Maybe other people will be better at explaining what you are doing wrong.
As for my part: I won't do your homework.
Just a hint: You might want to look at the function "prod". And maybe also read what persistent variables are.
An advice for the future: At least try to read what people are answering. To be honest, it is frustrating that you are asking the same questions again and again.
Markus
Gesendet: Montag, 25. Februar 2019 um 09:01 Uhr
Von: "Robert Setif" <address@hidden>
An: "Markus Mützel" <address@hidden>
Betreff: Re: message "error" 'n' undefine near ...
Hello !
My joined files still report the same mistake " 'n' undefined".Is it possible to correct it ?
I fought a long time with "zeros...". I think my solution is perhaps clumsy : it would be
nice to improve it.
Thank you very much and best regards.
Le dim. 24 févr. 2019 à 16:31, "Markus Mützel" <
address@hidden> a écrit :
On 24 Feb 2019 11:13:57 "Robert Setif" wrote:
>
> Good morning!
Je ne comprend pas pourquoi vous posez les mêmes questions autre y autre fois. Même si on vous a répondu plusieurs fois, vous continuez à ignorer les réponses constantement...
That's all my rusty French will do. Please, see the answers *again* below in English.
> Mon fichier joint (file joigned) a des probl?mes.
> Quand on le lance, il annonce une erreur ("undefined n").
> Mais dfac(10) -> 3840 ok!.
> 1. Comment corriger cette erreur "undefined n" ?
Your function "dfac" has one input argument "n". You probably see this error because you called the function without input argument. I haven't tried but something like "dfac(5)" should not throw this error.
> 2. Comment vectoriser dfac: dfac([0:12]) -> nothing !
Each line of your function must accept "n" as a vector for this to work.
E.g. instead of writing:
if (n==0)
r=1;
endif
you would write:
r = zeros (size (n)); % initialize r to the same size as n
r(n==0) = 1; % only set those elements in "r" that correspond to n==0
And appropriately for the other conditional branches.
> Thank you very much and best regards.
> address@hidden