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.

Answers (1)

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.

Categories

Find more on Scripts in Help Center and File Exchange

Products

Tags

Asked:

on 20 Mar 2018

Answered:

on 20 Mar 2018

Community Treasure Hunt

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

Start Hunting!