• Advertisement
Sign in to follow this  

Matlab7 question

This topic is 4383 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
I don't think you could use it without writing a little custom script, but I don't see why a matrix couldn't hold memory addresses instead of values. I just wouldn't expect the standard operations to handle it gracefully.

Then again, maybe you could make it work.

Good luck!

Share this post


Link to post
Share on other sites
The closest thing to that using what MATLAB provides is a cell matrix of vectors. There are no linked lists in MATLAB, and writing your own in MATLAB script is nothing I recomend. It's going to be really messy, as MATLAB doesn't have anything similar to pointers or references; only values.

If you really, REALLY, need a linked list structure over a vector structure in MATLAB, I strongly suggest you write one yourself in C or C++ and compile into a MEX-file.

The cell matrix is created and accessed like this.

>> A=cell(2, 3)
A =
[] [] []
[] [] []

A is now a 2 by 3 cell matrix. Initially all elements are empty vectors.

>> A{2,2} = [1 2 3 4]
A =
[] [] []
[] [1x4 double] []

Use {} to access cells, not () as with arrays, and each cell is an independent entity. Each cell can contain different types (strings, vectors, nested cell matrices, aything), and of different size aswell.

Share this post


Link to post
Share on other sites
There are some common extensions that add linked list functionality to matlab.

For instance: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=212&objectType=file

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement