[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Octave error:"error: can't perform indexing operations for <unknown type
From: |
smattiuz |
Subject: |
Octave error:"error: can't perform indexing operations for <unknown type> type " |
Date: |
Thu, 30 Oct 2008 07:24:53 -0700 (PDT) |
I get this error
[quote]
error: can't perform indexing operations for <unknown type> type
[/quote]
while running this code
array --> uses array.m file to allocate an array with 5000 0<=integers<=9
B=[0]; --> allocates my result array
Code:
[code]
resto=0;
tic
for i=1:1:length(A)
B(1)=+A(i);
if B(1)>9
if length(B)==1
B(2)=0;
end
B(2)=+1;
B(1)=-10;
k=2;
while B(k)>9
if (length(B)==k)
B(k+1)=0;
end
B(k+1)=+1;
B(k)=-10;
k=k+1;
end
end
end
toc
[/code]
this script is like a counter, adding one on one the 5000 numbers in the A
matrix to the B(1) cell of the array and checks if this number is >9. In
this case it put in B(k) the remnant, and B(k+1) is increased by one
ex.
B(1)=9, Adding 3 -> B(1)=12.
B(1)=2 B(2)=1
so this is like the result number (ex 12) is putted reversed in the array
(21)
since everytime it checks if there's the next cell (i'm supposing that the
only way the next cell cannot exist is when my counter is in the last
position of the B array), if not i create a B(k+1)=0 cell, so i'm sure i
have a new cel which i can add +1 furthermore.
So where's my problem? (except my non-optimized code)
--
View this message in context:
http://www.nabble.com/Octave-error%3A%22error%3A-can%27t-perform-indexing-operations-for-%3Cunknown-type%3E-type-%22-tp20248052p20248052.html
Sent from the Octave - General mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Octave error:"error: can't perform indexing operations for <unknown type> type ",
smattiuz <=