From help-request at octave dot org Tue Feb 8 10:56:00 2005 Subject: Re: indexing in octfile From: Brian Blais To: David dot Bateman at motorola dot com Cc: help at octave dot org Date: Tue, 08 Feb 2005 12:00:20 -0500 David Bateman wrote: > Brian Blais wrote: > >> what is the equivalent cc code for: >> >> m(3:6)=5 >> >> or >> >> m(3:6)=6:8; >> >> or >> >> m(3:6)=m(3:6)+6:8; > > > The equivalent to index is "assign" which you'll find in ov-base-mat.cc. > However, I don't see a case where you should use such an example. Better > to write a generic function and do the indexing/assignment exterior to > the function eg Thanks for the response, I realize that this particular example is not a good use of the octfile indexing, but it is simple enough that I can learn how to do the more complicated example I am actually interested in. I've looked at the ov-base-mat.cc cod, and frankly I find it very difficult to learn these sorts of things directly from the octave source code. I'm sure this is completely my problem, being somewhat new to C++, and very new to the octave classes. Would you be able to write me a short example of how to use "assign" in the examples I list above? I don't see a version of "assign" which takes an idx_vector, or uses the Matrix class, looking at the OctaveClassReference documents. At some point, I hope to be able to know enough to give back to this community. One thing that I think would be useful, and I am working on it by necessity, is a collection of simple "hello world"-type programs which illustrate the uses of each of the most commonly used octfile features. I've read the prthomas "cookbook" which is enormously helpful, but I think there are a few other examples that would be nice to have. If there is someone more experienced who has done this already, I'd love to see it. On a side note, I am coming from years of Matlab experience. One of the things that existed for Matlab, and I was wondering if it exists for Octave, is the user contributed m-file database. It seems as if octave-forge is like that, but how do you submit to it? Is there a more informal place for such things? Sometimes I write a small script or function that I think others might find useful, but I don't think is so important that it needs to go into a large effort like octave-forge. Anyway, just a few thoughts. thanks again, Brian Blais -- ----------------- bblais at bryant dot edu http://web.bryant.edu/~bblais ------------------------------------------------------------- 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 -------------------------------------------------------------