I don't think you need the Frames (or Slices) options at all, assuming you want to write all data in one go.
Below is a simple example that works for me. It requires the following variables:
- Info from an existing dataset (using BrikInfo),
- DATA as a X x Y x Z x T matrix (T=1 in your case; you may set subbrikcount=1)
- fnout as the name for your output brik
- a 'briklabels' cell where each element is the label for that subbrik (you could use briklabels={'foo'} to see if it works).
It writes a brik in floats, while it sets the statistical parameter of each subbrik as a z-score.
best,
Nick
subbrikcount=size(DATA,4);
myOpt=struct();
myOpt.Prefix=fnout;
myOpt.OverWrite='y';
myInfo=Info; %copy from input data
myInfo.BRICK_TYPES=repmat(3,1,subbrikcount); %float
myInfo.BRICK_STATS=[]; %is set by writebrik (see documentation)
myInfo.BRICK_FLOAT_FACS=[]; %" "
myInfo.DATASET_RANK(2)=subbrikcount;
myInfo.SCENE_DATA(2)=11; %brik
myInfo.HISTORY_NOTE=[myInfo.HISTORY_NOTE '; my genious comments' ];
brikstataux=[];
headers=[];
for i=1:subbrikcount
if i>1
headers=[headers '~'];
end
headers=[headers briklabels{i} ];
brikstataux=[brikstataux (i-1) 5 0]; %z score
end;
myInfo.BRICK_LABS=headers;
myInfo.BRICK_STATAUX=brikstataux;
myInfo.STAT_AUX=[];
fprintf('Writing brik with headers %s\n', headers);
disp(myInfo);
[err, ErrMessage, newInfo] = WriteBrik(DATA, myInfo, myOpt);