How do I separate data into different columns from a text file?

I am a beginner in terms of matlab and needed help on a project I am working on. I have a text file with several values (6 different categories) and I cannot seem to divide those values into six different columns on MatLab. Anyone can help me to understand how to write the code? Here is the txt file as an attachment so you can understand better.

답변 (1개)

Star Strider
Star Strider 2018년 3월 20일
I am not certain what you want.
This version copies column 1 to (498x2) matrices for each column, in case you need the information in column 1 for the others:
D = load('SJCPNTS200001020300.txt');
Col_2 = D(:, [1 2]); % [Column #1 Column #2]
Col_3 = D(:, [1 3]); % [Column #1 Column #3]
This version copies columns 2 through 7 to different single columns:
Col_2 = D(:,2); % Column #2
Col_3 = D(:,3); % Column #3
Continue for the rest. Give them meaningful variable names.

카테고리

도움말 센터File Exchange에서 Scripts에 대해 자세히 알아보기

제품

태그

질문:

2018년 3월 20일

답변:

2018년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by