看板 MATLAB 關於我們 聯絡資訊
我在主視窗中輸入 x = 1:10; y = [x; sqrt(x)]; fid = fopen('sqrt.dat', 'w'); fprintf(fid, 'Table of square root:\n'); fprintf(fid, '%2.0f => %10.6f\n',y); fclose(fid); type sqrt.dat (源自 張智星 書本) 錯誤顯示: ??? Error using ==> fprintf Invalid file identifier. Use fopen to generate a valid file identifier. 試過許多例子,都會有這樣的問題,請問該如何解決? 謝謝!!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.96.135
Steven0422:fopen失敗 看一下fid的值 05/19 18:50
littledou:測試出來是-1 請問 那個檔案室原本就要存在嗎 05/20 04:05
brettchen:我照你的打沒事,路徑中有中文嗎? 05/20 06:00
brettchen:版本2010b 05/20 06:01
vincent59:我測試過也ok阿 05/20 12:05
littledou:我的資料夾中有中文~~ 我試著換成英文看看 05/20 12:52
littledou:後來發現是路徑執行位置的問題 已經解決 謝謝大家 05/20 20:09