i have to read a text file which contains 50 rows and 2 colums... 1 have to assign the 1st column into one variable and 2nd column to another variable.. what i have to do?
조회 수: 1 (최근 30일)
이전 댓글 표시
i have to read a text file consists of numbers which is arranged in 50 rows and two columns ... means in a matrix form 50*2[m*n].. i have to assign the first column to a variable A ... and second column to a variable B... what i have to do???
댓글 수: 0
채택된 답변
Rizwana
2014년 1월 22일
1st you need to import your .txt file from the drop down menu by clicking file on upper corner of your matlab window. Then A = data(:,1); reads 1st coulmn and B=data(:,2); data is the name of .txt file
댓글 수: 0
추가 답변 (1개)
Shameer Parmar
2014년 1월 22일
Data = importdata('<txt filename>');
Column1 = Data(:,1);
Column2 = Data(:,2);
You can also create your own script by putting these command into it OR you can directly use these command by keeping your file into Matlab current directory.
참고 항목
카테고리
Help Center 및 File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!