Extracting Data from a Comma Separated List

I would to take data from a list in the following form and store it in vectors:
1;2
3;4
5;6
7;8
However, I need the data to be stored in vectors in the following fashion so that it can be plotted:
[1 3 5 7]
and
[2 4 6 8]
What is the best way to go about doing this?

댓글 수: 1

Where your data are stored? a text file ? or what kind of file?

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

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 25일

0 개 추천

If your data are stored in a text file
data=dlmread('file.txt')
r1=data(:,1)'
r2=data(:,2)'
Image Analyst
Image Analyst 2015년 7월 25일

0 개 추천

Have you tried dlmread():
% Read from file with semicolon delimeter.
array2d = dlmread(filename, ';');
% Get column vectors and transpose into row vectors.
array1 = array2d(:, 1)';
array2 = array2d(:, 2)';

카테고리

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

질문:

2015년 7월 25일

답변:

2015년 7월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by