[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: message "error" 'n' undefine near ...

From: Markus Mützel
Subject: Re: message "error" 'n' undefine near ...
Date: Sun, 24 Feb 2019 16:31:43 +0100

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 
That's all my rusty French will do. Please, see the answers *again* below in 

> 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)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]