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!