Find rows in cell for each array between two values and create new cell with the values you just found
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello
For better understanding i attached an image of the problem.
I have two 8x5 cells n and p, which have the same size of arrays but different values in them. The arrays in the two cells countain all double values and each array in a cell has a different size.
I want tio create two new cells n_new and p_new which should contain values of the array itself.
x is the start value and y the end value. Im looking for a code wich goes to each array in cell n, looks for the start and the end and then writes the values which lie in between x and y to a new array in a new cell. So n_new{1,1} starts with the first value where n_{1,1} < x and ends with n{1,1}<y
This for each array so i thought it could work with a for loop like that, but the error says "Operator '<' is not supported for operands of type 'cell'."
for i =1:8
for u =1:8
row_start{i,u} = find(n<x,1);
row_end{i,u} = find(n<y,1);
n_new{i,u} =n{i,u}(row_start{i,u}:row_end{i,u})
end
end
I cant convert the whole cell two double. I found a way to do it, but it would be a 50 lines code for each array and im sure there is better way for the Problem.
Thanks in advance
Simon
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numeric Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!