I have a table of data in form of .txt file, I have imported using the textscan function,now it is taking whole row of data as a string, what if I want to access to each word individually,Please let me know with alternatives ,Thanks

조회 수: 1 (최근 30일)
Name Rank Class Average
Jhon 2 09 70
Jhon 1 09 90
If this is the table for example, How to get the unique word out of the rows??? How do I compare bot and Output should be 1, because rank column data is different, 2 and 1,since 1 comes first in row, I should name it as key.

채택된 답변

Friedrich
Friedrich 2014년 1월 17일
편집: Friedrich 2014년 1월 17일
Hi,
you can use
fid = fopen('data.txt','r')
header = textscan(fid,'%s%s%s%s',1,'delimiter',' ')
data = textscan(fid,'%s%f%f%f','delimiter',' ')
fclose(fid)
to read in the data. Then the variable data reflects the table structure of your file. So data{1} gives the first column and data{1}(2) would give the second entry in the first column
  댓글 수: 1
Aditya
Aditya 2014년 1월 17일
Hello Friedrich, Can we compare each of these cells and obtain a unique field as a result, in case I have a pool of data rather having just a table of two columns as in above case. Pl let me know.!
Thanks

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by