[問題] 請問一個讀txt檔的問題已回收

看板MATLAB作者 (ICA)時間14年前 (2010/01/12 13:19), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
有一個文字檔內容為 DOC meaning : This alert is there for ADA consistency, and used internally as a default value. action : None. DOC 目的為如何把它讀進matlab成為一段完整的文字如下: meaning : This alert is there for ADA consistency, and used internally as a default value. 我試過以下的code fid =fopen('test.txt','r'); C=textscan(fid,'%s'); 但所讀到的結果是完全連在一起的 [C{1}{2} C{1}{3}.... C{1}{n}] meaning:ThisalertisthereforADAconsistency,andusedinternallyasadefaultcode. 請問有沒有辦法是一次將一整行的文字存在資料裡 如: C{1}{2}='and used internally as a default value.' 而不是一次只讀一個字元 如: C{1}{2}=meaning C{1}{3}=: C{1}{4}=This 謝謝囉!!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.231.238.6 ※ 編輯: ICA11 來自: 61.231.238.6 (01/12 13:21)

01/12 17:23, , 1F
fgetl
01/12 17:23, 1F
文章代碼(AID): #1BJ0PcyV (MATLAB)