Finding values in an Array
조회 수: 5 (최근 30일)
이전 댓글 표시
If I have an array such as
Subject= [126;156;1992, 203, 186] % First two digits determine group, additional numbers are specific subject within that group.
Is there a method to only read the first two values of each row in order to determine what group the subject is?
Group= [12;15;19;20;18] %%%This is what I would like the result to be.
댓글 수: 0
채택된 답변
Jos (10584)
2014년 1월 30일
Apply some arithmetic:
Subject = [126 156 1992 203 186 10 100 100000]
Group = fix(Subject ./ (10.^floor(log10(Subject)-1)))
추가 답변 (2개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!