I am trying to do a few things with arrays in Real Studio, but can't seem to find anything about them in the documentation.
The first thing is extracting subsets of multidimensional arrays: I want to make a new vector out of a piece of a column in a matrix I have filled. In MATLAB or R this would go something like Matrix(1:5,2) to extract rows 1 to 5 of column 2. Is there any easy way to do this in Real Studio?
On a similar note, I am wondering if there is a way to get a function or operation to return the index of a cell in an array, rather than the value stored. For example, if I was using the max function on something like max([1 2 3 4 8]) I would want the index of the largest value (5) returned, not 8.
Thanks! Let me know if I can be more specific.
For the first part about extracting subsets: you would have to simply create a method that will do that for you. You could use the Extends keyword to easily create a method that will return part of an array with the syntax myArray.getSubSet(1,5,2). Info on Extends: http://docs.xojo.com/index.php/Extends
In terms of getting the index of the cell in an array, if it's a one-dimensional array you can use array.indexOf(value) to have it return the index. If you want the index of the max value, theIndex = array.indexOf(max(array))