2010-09-09 53 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