|
"Simon Buckley" <Simonthomasbuckley@gmail.com> wrote in message <hdje3q$3a1$1@fred.mathworks.com>...
> Hey guys,
>
> I'm new to MATLAB and I am attempting to analyse data form FRFs and determine Outliers. I need to cycle through 15 sensors and 4097 spectral lines. How do I save the data as it cycles through? At the moment all I get is the last bit of Data
Well, you can either use a cell array, or save it to disk:
>
> load N1.mat;
> load D1.mat;
> Total_mean=mean(FRFmagN1,3);
>
novelty = cell(15, floor(4048/10)); % Make cell array
> for sensor=1:1:15,
> for start=1:10:4048,
> sensor;
> start;
> Training_Feature=squeeze(FRFmagN1(sensor,start:start+49,:));
> Testing_Feature=squeeze(FRFmagD1(sensor,start:start+49,:));
> Feature_mean=Total_mean(sensor,start:start+49,:)';
>
>
> Feature_Cov=cov(Training_Feature');
novelty{sensor, (start-1)/10+1}=zeros(1,150); % Initialize this cell with zeros
> for i=1:150;
>
% Write data
novelty{sensor, (start-1)/10+1}(1,i)=(Testing_Feature(:,i)-Feature_mean)'*inv(Feature_Cov)*(Testing_Feature(:,i)-Feature_mean);
> end
> end
> end
>
> I need to save each time it cycle through novelty(1,i)
>
> Thanks
Otherwise, after the first loop is finised:
save(sprintf('novelty_sensor_%02d_idx_%04d', time, start), novelty);
Sebastiaan
|