Thread Subject: preallocation for object array

Subject: preallocation for object array

From: Abel Brown

Date: 7 Jul, 2009 20:39:01

Message: 1 of 1

Typically if you're going to loop and grow a vector in matlab you'd like to preallocate first. for example:

vec = zeros(N,1);
for i = 1:N
   vec(i) = someNumber
end

But what if I have some class

classdef point

   properties
     x
     y
   end

...

where x and y are a single double.

How would I preallocate for a vector of point objects?

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
objects Abel Brown 7 Jul, 2009 16:44:02
memory Abel Brown 7 Jul, 2009 16:44:02
preallocation Abel Brown 7 Jul, 2009 16:44:02
array Abel Brown 7 Jul, 2009 16:44:02
rssFeed for this Thread

Contact us at files@mathworks.com