精華區beta MATLAB 關於我們 聯絡資訊
※ 引述《john0908 (有棒球真好)》之銘言: : 我遇到一個問題 不知該如何解決 : 我現在要把數據值 抓到MATLAB裡面去 但不知道該怎麼做 : 目前使用的方式是使用fopen去開檔 再用fgetl去取值 : 把取到的值擺到振列裡 再去做運算 : 程式碼如下 : fid=fopen('123.txt') : a(1:100)=0; : for i=1:100 : a(i)=fgetl(fid) : end : 但這樣運算時是錯的 不知道該怎麼去寫... : 請問誰知道問題出在哪 或是有更好的方式可以來解決.. : 謝謝喔~~ 抓值的話 我都是用fscanf fid = fopen('某檔案.txt','r') ; 某變數 = fscanf( fid , ' %g ' ) ; 不過這樣只能把整個txt抓成一個矩陣 其他讀檔還在研究 -- Deserves death! I daresay he does. Many that live deserve death. And some die that deserve life. Can you give that to them? Then be not too eager to deal out death in the name of justice, fearing for your own safty. Even the wise cannot see all ends. Gandalf to Frodo -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.225.207.78