how read array from a text file??

Hello
I have a text file having data like:-
12 23 24
45 66 99
11 22 33
these are in array form and
i want to read these array values as we generally access array values like
for example- i get the first row in a variable say- A i.e
A = 12 23 24
and on accessing A(1) it will give ans-12
so i want read this way.
Any help will be appreciated.
Thanks
Ashish

답변 (2개)

Andrei Bobrov
Andrei Bobrov 2012년 5월 17일

0 개 추천

A = dlmread('nametextfile.txt')

댓글 수: 2

Ashi
Ashi 2012년 5월 18일
now i want to read my data column wise not row wise.
Walter Roberson
Walter Roberson 2012년 5월 18일
A(:,1), A(:,2) and so on.
Or transpose the result you get from dlmread()

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

Ziraddin Gulumjanly
Ziraddin Gulumjanly 2022년 5월 19일

0 개 추천

12 34 82
23 54 22
34 92 29
45 91 21
67 63 12
45 43 77
43 12 75

카테고리

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

질문:

2012년 5월 17일

답변:

2022년 5월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by