advice with pointers in matlab -


i running large meta-simulation go through 2 hyperparameters (lets x , y) , each set of hyperparameters (x_i & y_j) run modest sized subsimulation. thus:

for x=1:i     y=1:j         subsimulation(x,y)     end end 

for each subsimulation however, 50% of data common every other subsimulation, or subsimulation(x_1,y_1).commondata=subsimulation(x_2,y_2).commondata.

this relevant since far total simulation results file size ~10gb! obviously, want save common subsimulation data 1 time save space. however, obvious solution, being save in 1 place screw plotting function, since directly calls subsimulation(x,y).commondata.

i wondering whether subsimulation(x,y).commondata=% pointer 1 location in memory %

if cant work, less elegant solution:

subsimulation(x,y).commondata='variable name' %string 

and adding

if(~isstruct(subsimulation(x,y).commondata)),      subsimulation(x,y).commondata=eval(subsimulation(x,y).commondata) end 

what solution guys think best?

thanks dankmasterdan

you defining handle class. see the documentation.

an example:

classdef simulationcommondata < handle     properties         somedata     end      methods         function = simulationcommondata(somedata)             % constructor             this.somedata = somedata;         end     end end 

then use this,

commondata = simulationcommondata(something); subsimulation(x, y).commondata = commondata; subsimulation(x, y+1).commondata = commondata;  % these point same reference (handle) 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -