saving a .csv file with text values as a .mat file
2 ビュー (過去 30 日間)
古いコメントを表示
Apurva Jariwala
2019 年 2 月 19 日
コメント済み: Apurva Jariwala
2019 年 2 月 19 日
I tried using csvread, but it only accepts csv files with numeric values. I want to convert a csv file e.g. fisheriris.csv to .mat file, how can i do that?
Also, how to change the class labels with numbers or letters like a,b,c.. ?
0 件のコメント
採用された回答
Walter Roberson
2019 年 2 月 19 日
T = readtable('fisheriris.csv');
Tlabcat = categorical(T{:,5});
Tcats = categories(Tlabcat);
Tlabnum = double(Tlabcat);
Tnum = [T{:,1:4}, Tlabnum];
Now Tcats is a cell array of character vectors indicating the category names, and Tnum is a double array of the data, with the last column being a class number converted from the text category labels.
その他の回答 (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!