How to downsample cell arrays based on specific criteria?

3 次查看(过去 30 天)
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 中查找有关 Whos 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by