Using if condition store values in an array
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a list of numbers stored as double type in a variable B. I want to use if condition so that if the value of element in B is greater than or equal to 12, I want to store all those values in another array named C.
채택된 답변
the cyclist
2021년 2월 19일
If I understand you correctly, this does what you want. (It doesn't directly use "if", but does the job via logical indexing instead.)
C = B(B>=12);
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!