Discussion:
error: subscript indices must be either positive integers or logicals.
(too old to reply)
el vic
2010-06-30 19:31:34 UTC
Permalink
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
Francesco Potortì
2010-07-10 15:57:21 UTC
Permalink
Post by el vic
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 you want the source file to be loaded automatically, you must call it
with the same name as the function. In this case, MN.m

I don't know if this answers your question.

Loading...