Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
[HELP plz] How to seperate Column Data into values greater than and less than all into new Column
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi
I have a problem, where i get undefined function gt and so on...annoying and cant figure why..been searching the net and no luck. here is the question:
i have a matrix with: 137242x1 cell called V. containing some voltage. what i want this code to do is seperate the voltages so it makes a new Column with Values greater than 230 into 1 Cell for itself..and values less than 225 into another..and values remaining at 225-230.
i have for starters used for..but not working:
n = 1;
i = 0;
for i=1:length(V)
X = V > 230
end
help please :)
댓글 수: 5
Walter Roberson
2014년 3월 18일
If U is a cell array then U' does not turn it into a vector: it takes the transpose of the cell array leaving a cell array as the result.
답변 (1개)
Walter Roberson
2014년 3월 17일
If each cell contains exactly one scalar, then the simplest to program is
U = cell2mat(V);
and then work with the numeric matrix U in ways similar to what Metin showed.
idx1 = U > 230;
idx2 = U < 225;
idx3 = ~(idx1 | idx2);
k_1 = U(idx1);
k_2 = U(idx2);
k_3 = U(idx3);
댓글 수: 2
Walter Roberson
2014년 3월 18일
Your cell array is not completely numeric. The string in your first cell is causing the problem.
Do as I showed above but starting with
U = cell2mat(V(2:end));
Provided that all the other entries are numeric scalars.
Question: do the cells hold strings rather than numeric values??
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!