How to create variable name for .CSV file in matlab?
8 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have CSV file as below
![Main.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197002/Main.jpeg)
I want to create names for VarName upto end of the matrix. I have to write the code for changing the VarNames automatically. I need the output as below. Please let me know if anyone knows the ans.
![output_image.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197003/output_image.jpeg)
Thank you in advance.
3 件のコメント
回答 (1 件)
Arunkumar M
2018 年 11 月 28 日
Hope you have already imported data into workspace as table. Assuming table name is Reducedfeatures
% for defining name for all columns at once
Reducedfeatures.Properties.VariableNames = {'C1','C2',.......}
% for defining specific column names, example: first and second column
Reducedfeatures.Properties.VariableNames([1:2]) = {'C1','C2'}
4 件のコメント
Claudio Ignacio Fernandez
2020 年 7 月 28 日
Hello
I'm following your example but I'm getting this message
Unable to perform assignment
because dot indexing is not
supported for variables of this
type.
Jan
2020 年 7 月 29 日
@Claudio: Please post your code. How is your variable called "Reducedfeatures" here defined in your case?
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!