help-octave
[Top][All Lists]
Advanced

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

RE: DON'T UNDERSTAND WHY I GET - error: subscript indices must be either


From: dastew
Subject: RE: DON'T UNDERSTAND WHY I GET - error: subscript indices must be either positive integers or logicals.
Date: Wed, 30 Jun 2010 23:02:50 +0000



> Date: Wed, 30 Jun 2010 13:59:25 -0700
> From: address@hidden
> To: address@hidden
> Subject: DON'T UNDERSTAND WHY I GET - error: subscript indices must be either positive integers or logicals.
>
>
>
> Hello I made a function "MN.m" yesterday wich worked pretty well...
> today I try to use it again and it keeps saying me
>
> octave-3.2.3:23> MN (a,b)
> error: subscript indices must be either positive integers or logicals.
>
> the thing that I DON'T UNDERSTAND is why when I made a new file called
> "MN_v1.m" it works just fine
>
> If someone can explain to me why is this going on and could tell me
> what to do I will be very much appreciated, me and my masters thesis.
>
> thank you all.
>
> the function goes as follows:
>
> function MN = MN ( MD, BM )
> # variable initialization
> v = [0];
> mn = [0];
> a = [0];
> MN = [0];
> # to know how many rows and columns our Inputs have
> [num_circuitos,num_pares] = size (BM)
> [lambda,num_heligiros] = size (MD)
> # the main idea is to take each and every row of the Input 'BM' and
> diagonalize the vector forming a 'mat_diag' matrix which will multiply
> the input 'MD'. Then we will arrange each partial result under the
> previous one.
> for i = 1:num_circuitos;
> v = BM(i,:)
> mat_diag = diagonal (v)
> mn = MD * mat_diag
> if MN == [0];
> MN = mn;
> else
> MN = [MN;mn];
> endif
> endfor
> # printing the result
> MN
> endfunction
>
> -----
> victor carreto
> address@hidden



I think the answer is:

you named the function MN   in a file called MN.m

then you maned a variable called MN

then next time you try MN you will get the variable MN with brackets after it and the interpreter   thinks you are indexing into an array.

Try changing the name of your variable MN
Doug

reply via email to

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