gusl: (Default)
[personal profile] gusl
plot(record{3}.nEvals,record{3}.objec)
does not work (I get a colorful straight line).

o = record{3}.objec;
n = record{3}.nEvals;
plot(n,o)
works: I get the curve I'm looking for.

Other concerns: I'd like to pass objects by reference, and avoid implementing my own data structures (List anyone?).

I'm hoping to switch to NumPy this summer. They say the syntax is remarkably similar, and I'd mostly only have to worry about array bounds (Matlab counts from 1, Python from 0).

(no subject)

Date: 2009-04-06 01:53 pm (UTC)
From: [identity profile] gfish.livejournal.com
I'm pretty happy using NumPy. It keeps most of the best parts of matlab without the same tendancy towards completely and utterly unreadable code.

Pass by reference

Date: 2009-04-08 11:35 am (UTC)
From: (Anonymous)
FWIW, there are a few options for pass by reference in MATLAB. There is a map (similar to a hash table), introduced I think in R2008B. It's called "container.Map." If you want to implement your own data structure, you can create custom classes that inherit from handle, which gives reference behavior.

As for the behavior you are seeing - it looks like there might be something else going on with your code. I built a little snippet that reproduces your example, and it seems to work fine.

- scott
http://www.mathworks.com/matlabcentral/fileexchange/authors/3777

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags