num2str or str2num?
이전 댓글 표시
I am trying to make a table of numbers with corresponding names for example: names and grade table sorted by the number
Bob 97
Joe 87
Sally 88
How do i setup a variable to equal something like a= Bob 97 so when i go to do the fprintf it will sort by the numbers in the second column and leave the corresponding names to the number in the first column
final table should look like:
Name Grade
Joe 87
Sally 88
Bob 97
댓글 수: 2
per isakson
2012년 4월 29일
Why not int2str?
Image Analyst
2012년 4월 29일
Because he wants it sorted by grade, and the grade doesn't necessarily show up in the same column, or even in a single column, if the names have different lengths:
>> int2str('Sally 88')
ans =
83 97 108 108 121 32 32 32 56 56
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!