How to downsample cell arrays based on specific criteria?

조회 수: 9 (최근 30일)
David Mrozek
David Mrozek 2021년 3월 6일
편집: David Mrozek 2021년 3월 7일
Hello everyone,
So far I have, thanks to the MVP Jan, a macro ready data table for the majority of 3D printers which are stationed in our lab. In order to improve the printing time as well as the macro running time I came to the conclusion that I need to downsample some of the data based on the current computer processing power in the lab. In order to achieve this I wanted to specifically reduce the amount of rows in the data file according to this code:
for counter = 1:Datalimit
% The counter goes up until the Datalimit (value based on integer type) is reached
criteria_1 = round(height(EXPORT{1,1})*0.1);
% By counting the height of the EXPORT variable the amount of data is reduced
EXPORT{1,(counter)}...
% The criteria will be used for every cell array. E.g EXPORT{1,1}, EXPORT{1,2}
%(not sure is if this line is neccesary)
= downsample(...
EXPORT{1,counter},criteria_1...
% As seen here the first argument represents the current target(current cell array) of the criteria
% The second argument is the postive integer which reduces the cell array
);
end
The problem of here is that my code deletes some important strings as well as values from the EXPORT variable. Hence I need to "insert" some exception for the following...
a.) Strings: 'StartCurve','EndCurve'
b.) Values : -75 and 75
Is this achievable with the following toolboxes as well as my current code?
Do you have proper approach for this problem?

채택된 답변

Jan
Jan 2021년 3월 7일
It would be much easier to reduce the number of points before you convert the nermical data to cell arrays.
if ischar(In{k});
Out{k} = {In{k}, [], []}; % Or '' instead of [] ?
else
% Reduce the array size here.
smallerIn_k = resample(In{k}, ???)
Out{k} = num2cell(smallerIn_k);
end
Are you really sure that it is useful to convert these data to a cell array?
  댓글 수: 1
David Mrozek
David Mrozek 2021년 3월 7일
편집: David Mrozek 2021년 3월 7일
I am aware of the last post.However I have taken your advice and reduced the number of points (before the conversion) based on a data point limit which I aquired by plotting the amount of total data points as a function of the time which is necessary to process them in the script. I repeated this process for all our lab computers which were available. In total I reduced the script running time in an intervall between 27,4 and 36,9 % (depending on the current operating lab computer) compared to the unreduced data. So thank you very much for this little but helpful hint!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by