Is there an object similar to Matlab vectors/matricies/cells?

A

A C

Hello

I am after a vector/matrix/cell style object like there is in Matlab whereby
we can read data into this matrix and maipulate it. All the sizing etc is
automatically accounted for by the object itself when the data is assigned
to the object, and its easy to do things like pull out columns 1-->5, count
etc etc.

Converting from an existing Matlab program and Matlab has lots of nice
features for manipulating cells/vectors/matricies which I would love to have
avaiable.

Contents is not just numbers so its not a math vector etc I am after. For
example it might read in a table of data where some fields are text and some
are numbers. Basic manipulation, for example append, combine, remove these
cols, remove these rows, sort, remove repeats, unique etc etc.

Regards
A
 
N

Nick Hebb

The only thing like Matlab in Excel is Matlab itself. That is,
Mathworks sells an Excel add-in that uses Matlab for all the
computations. I think its pretty spendy though.

Really, the closest built-in object with the capabilities that you're
describing is probably a worksheet. Excel has a few built-in matrix
functions, but with nowhere near Matlab's capabilities. You'd have to
code a lot of it yourself.
 
D

Dana DeLouis

Hi. Excel can't do these operations as well as a dedicated math program.
If you would like, here are some ideas that may help a little. Good luck.
:>)
... things like pull out columns 1-->5, count
etc etc.

Sub Demo()
Dim v, c
Const All As Long = 0

'// 2 Dim array from A1:C5
v = [A1:C5]

With WorksheetFunction
'// Extract all rows in the 2nd Column...
c = .Transpose(.Index(v, All, 2))

'// How many elements?
Debug.Print "Number of items:";
Debug.Print (UBound(v, 1) - LBound(v, 1) + 1) * (UBound(v, 2) -
LBound(v, 2) + 1)

'// Simulate "AppendTo"
'// Add a new row (simulate adding a new list item)
v = .Transpose(v)
ReDim Preserve v(1 To UBound(v, 1), 1 To UBound(v, 2) + 1)
v = .Transpose(v)
v(UBound(v, 1), 1) = "a"
v(UBound(v, 1), 2) = "new"
v(UBound(v, 1), 3) = "row"
End With

End Sub

HTH:
 
A

Alan Beban

A said:
Hello

I am after a vector/matrix/cell style object like there is in Matlab whereby
we can read data into this matrix and maipulate it. All the sizing etc is
automatically accounted for by the object itself when the data is assigned
to the object, and its easy to do things like pull out columns 1-->5, count
etc etc.

Converting from an existing Matlab program and Matlab has lots of nice
features for manipulating cells/vectors/matricies which I would love to have
avaiable.

Contents is not just numbers so its not a math vector etc I am after. For
example it might read in a table of data where some fields are text and some
are numbers. Basic manipulation, for example append, combine, remove these
cols, remove these rows, sort, remove repeats, unique etc etc.

Regards
A
You might want to review the freely downloadable file at
http:/home.pacbell.net/beban to see whether any of the functions might
be helpful.

Alan Beban
 
A

A C

Thanks. Do you have an examples/demos of it working (programming skills not
great yet) so I can see how you declared things and how you called them.
Can it handle data that has multiple types? eg strings in some cells and
numbers in others all within the same range? That said maybe I can just
assume they are all strings, im not really wanting to do any calcs with the
contents just reformatting and outputting etc.

Regards
A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top