How to create variable name for .CSV file in matlab?

조회 수: 18(최근 30일)
Haritha 2018년 11월 27일
댓글: Jan 2020년 7월 29일
I have CSV file as below
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.
Thank you in advance.
  댓글 수: 3
Haritha 2018년 11월 28일
편집: Haritha 2018년 11월 28일
I want inside the code only. I am attaching one .csv file for experiment.Please check and let me know. Thank you in advance

댓글을 달려면 로그인하십시오.


Arunkumar M
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
Jan 2020년 7월 29일
@Claudio: Please post your code. How is your variable called "Reducedfeatures" here defined in your case?

댓글을 달려면 로그인하십시오.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by