2010-09-09 45 views
1

我想要做的是什麼已經在這個問題上已經說明了相反的:(例如codeserv = [NNNNNNNNNN ....] area = [IIIIIII ....] [.........]以格式開始向量寫一個txt文件?

problems with data acquisition from MATLAB

我會用向量傳遞到創建具有相同格式的文本文件如鏈接,即:

* Comment line 
| Code | serv | etc. ... 
* Comment line 
Figures | Figures | Figures | etc. ...... 

我們必須重建一個新的驅動器,或者你可以修改代碼?

感謝您的幫助和關於它的信息。

回答

0

而不是使用textscan爲了掃描一些輸入,您可以使用fprintf輸出。

1

這是一個小示例,應該幫助您將第一個文件從Matlab保存到硬盤上。

%some nr to integrate into the printf 
num=2.0 
%opens the file: 'file_name' with write access 
f = fopen(file_name,'w'); 
%writes some text into the file 
fprintf(f,'test-file dump\r\n'); 
%writes text and includes a fload number out of matlab workspace 
fprintf(f,'some-float=%f \r\n', num); 
%important closes the file, other wise no other program can grand write access on the file 
fclose(f); 

希望它有幫助。

+0

另請參閱'dlmwrite',使用'|'分隔符。 – 2010-09-10 10:32:07

+0

感謝您的幫助。我試圖暗示你的建議 – Marietto85 2010-09-13 09:22:23