필터 지우기
필터 지우기

How to make variable names the same as the column headers when importing?

조회 수: 2 (최근 30일)
Al
Al 2015년 4월 15일
답변: Image Analyst 2015년 4월 16일
Notes:
My column headings are V(001), I(B54)... There are thousands of them.
Currently if I use the import wizard, the column headers do not get used for the variable names. Matlab assigns VarName1, VarName2,...
I am importing a text file.
  댓글 수: 4
per isakson
per isakson 2015년 4월 15일
"Is there a way to have Matlab remove the parenthesis?"
  • With importdata &nbsp AFAIK: No!
  • With textscan &nbsp Yes, but it takes a some lines of code.
Questions
  • Do you really want 3400 separate variables?
  • Do you know the types of the data in each column - string or numerical?
Al
Al 2015년 4월 15일
I will not use all of the 3400 variables. The issue is the 100-200 I would use need to manually selected from a list during export. This would take a long time because they are difficult to find and you need to hold down the control key for each. Its easier just to export all 3400 and let matlab turn them all into variables, then comment out the ones I don't need.
All data are numbers.

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

답변 (1개)

Image Analyst
Image Analyst 2015년 4월 16일
I think the best approach is to use readtable() so that your fields have the names of your column headers. I think it will throw out the parentheses though.

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by