From help-request at octave dot org Sat Oct 15 14:38:13 2005 Subject: Re: error "can't perform indexing operations for type" From: David Bateman To: cmire CC: help at octave dot org Date: Sat, 15 Oct 2005 21:32:24 +0200 cmire a écrit : >I'm new to Octave, and I've got a short Matlab program from a professor that >we are supposed to modify to solve some homework problems. I've read that >Octave can run Matlab code (I've updated the ~/octaverc file accordingly, >etc.). > >When I try to run the code using the command "source(Exercise.m)", I get the >output: > >length = 10 >npoints = 200 >mass = 0.070000 >num_sol = 4 >error: can't perform indexing operations for type >error: evaluating argument list element number 1 > >I don't need help with the actual homework assignment -- I just need to get >this code working so I can proceed to do my homework. Help is greatly >appreciated! > > > Not sure why there is this error, and is certainly a bug in the version of octave you are using as it indicates that an uninitalized value is being returned from a compiled function, might be due to issues with eigs.. In any case the only version of eigs that exists for octave is the one I have that has serious stability problems and only works (and then just) for real symmetric marices. So I haven't made this version of eigs available. You therefore have two choices. 1) Forget trying to use octave for this code, or 2) change the eigs call to read something like [phi,te] = eig(Hmatrix); [te, idx] = sort(Hmatrix); te = te(1:num_sol); phi = phi(:,idx(1:num_sol)); though for large matrices and small num_sol this will be significantly slower than using eigs as all of he eigenvectors are calculated and you only pick num_sol of them. D. ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------