Finding category/string in table and converting values
조회 수: 5 (최근 30일)
이전 댓글 표시
Alright so I'm having trouble knowing how to write a script to convert values.
Basically, I want to 1) Read in a file or Access a table 2) Find all the instances in the rows of the table with the string "CBEAM" 3) In said row, go to the 4th column and multiply that number by 0.5 4) Find all instances in the rows of the table with the string "CQUADR" 5) In said row, go to the 6th column and multiply that number by 0.6
So I can envision lots of if, then statements, which is totally fine. But I really don't know how to get started or what to write at all. Can anyone help
댓글 수: 0
채택된 답변
Peter Perkins
2018년 2월 21일
Don't do that. Assume T is your data stored in a table containing a categtorical variable named SomeVarName whose categories are 'CBEAM' 'CQUADR', ... . Then
i = (T.SomeVarName == 'CBEAM');
T.SixthVarName(i) = .5 * T.SixthVarName(i);
etc.
댓글 수: 3
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!