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?
0 个评论
采纳的回答
Jan
2021-3-7
It would be much easier to reduce the number of points before you convert the nermical data to cell arrays.
See my answer in the other question concerning this problem: https://www.mathworks.com/matlabcentral/answers/762566-how-to-deal-with-nested-arrays-where-the-columns-and-rows-are-in-different-dimensions
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!