필터 지우기
필터 지우기

I loaded a data file, but why is matlab not able to name the different columns of data within the txt file?

조회 수: 7 (최근 30일)
I had a csv file with about 10 columns of data, each column is a set of values monitored over a certain amount of time; 1st column is time, 2nd column is speed 3rd column is altitude, etc...
the csv file was converted to a txt file and then loaded on Matlab (no errors at this stage), but then when I try to define the different columns it comes up with an error (Index in position 2 exceeds array bounds).
the code is:
load MONDOteam_26.txt %name of the file
SIM22time = MONDOteam_26(:,1) %define 1st column
  댓글 수: 1
Stephen23
Stephen23 2023년 10월 29일
"the csv file was converted to a txt file ..."
CSV files are text files, so that statement does not mean much. Do you mean that you changed the file extension?

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

답변 (1개)

Star Strider
Star Strider 2023년 10월 29일
It would be best not to convert the .csv file to a text file (or to anything else) initially.
Instead, use readtable to read the original .csv file with its single-line headings (variable names). Then, you should be able to work with it.
If you are not used to using table arrays, see Access Data in Tables to understand how to work with them.

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by