MATLAB Answers

How to split tall array with logical array?

9 views (last 30 days)
Mathias
Mathias on 15 Nov 2017
Hi everyone,
I have a tall array with measured data 'Output.uniData'. Via a filter i select different value ranges for the measured channels. For Example:
Setup.Selection(1).name = 'Chan7';
Setup.Selection(1).range = [1 100 ; 301 400]; % (>=1 & <=100) | (>=301 & <=400)
Setup.Selection(2).name = 'Chan5';
Setup.Selection(2).range = [1 200];
After checking the conditions and Logical operations i get a Logical tall Array 'Output.selectedLines' where every matching line is true.
In non-tall application then i would do something like this to store each block of trues in a separate file:
% evaluation areas
tempRange=[];
tempRange(:,1)=find(diff([false; Output.selectedLines; false],1,1)==1); % start of blocks
tempRange(:,2)=find(diff([false; Output.selectedLines; false],1,1)==-1); % end of blocks
% tempRange(:,1)=find(diff([tall(false); Output.selectedLines; tall(false)],1,1)==1); % doesnt work cause of find
% tempRange(:,2)=find(diff([tall(false); Output.selectedLines; tall(false)],1,1)==-1);
tempRange(end,:)=[];
for range=1:size(tempRange,1)
Head=Output.uniHeader;
Data=Output.uniData(tempRange(range,1):tempRange(range,2),:);
save(['file_' sprintf('%03d', range) '.mat'],'Data','Head');
end
Unfortunately it doesnt work on tall Arrays cause find is not supported.
Undefined function 'find' for input arguments of type 'tall'.
Can anyone give me a hint how to solve this please. Maybe there is also a better function to filter by different value ranges.
Thanks a lot

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!