Converting first column unique values to number
2 ビュー (過去 30 日間)
古いコメントを表示
I have a table that I need to use for another function.
Currently the table is setup as
Base1,x,y,z
Base1,x,y,z
Building2,x,y,z
Building2,x,y,z
Complex3,x,y,z
Complex3,x,y,z
Complex3,x,y,z
What I would like to do is rename the first column if they have unique names so Base1 would switch to 1, Building2 switches to 2 ect...
Is there an easy way to rename all of the first column based on if the values are unique or not?
2 件のコメント
採用された回答
Matt J
2019 年 6 月 28 日
編集済み: Matt J
2019 年 6 月 28 日
[~,~,u]=unique(yourTable{:,1},'stable');
yourTable{:,1}=num2cell(u)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Other Formats についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!