Working with Cell array (matrix) of structs
After some experiment I have ONE model as the result which is represented as struct:
>>models{1}
ans =
nstates: 3
type: 'mhmm'
nmix: 1
d: 1
cov_type: 'full'
init_type: 'manual'
pi_Prior: [3x1 double]
A_Prior: [3x3 double]
pi: [3x1 double]
A: [3x3 double]
mu: [52.9712 2.1608e+003 5.4774e+004]
Sigma: [1x1x3 double]
mixmat: [3x1 double]
loglike: [1x36 double]
So, after some series of experiments I have cell array (or matrix) of structs and the best way to get some fields of each model is:
nstates = cellfun(@(x) x.nstates, models(:), 'Uniform', 1); % for uniform output
logLikes = cellfun(@(x) x.logLikes, models(:), 'Uniform', 0); % for non-Uniform output, for expl. with %different length logLikes
if we have matrix of cells: models{nRuns, nModels} than we should use repmat at the end
logLikes = cellfun(@(x) x.nstates, models(:), 'Uniform', 0);
logLikes = reshape(logLikes,nRuns,nModels);
Speeding up with repmat function (MEX version)
To run your matlab applications with repmat “functionality” faster, you can use MEX format of this function from Lightspeed matlab toolbox.
With the same initial conditions you can see “productivity boosting”. Figure 1 – with default repmat function. Figure 2 – with MEX version of repmat function.

Fig.1 matlab default repmat function

Fig. 2 MEX version repmat
| Posted in Matlab, Software | 1 Comment »
MCMC methods with a nice applete
Nice example at http://www.lbreyer.com/classic.html will demonstrate how MCMC works.
| Posted in Matlab, Software, Statistics | No Comments »

| Posted in Matlab | No Comments »