保存文本文件 [英] Saving a text file

查看:89
本文介绍了保存文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将矩阵另存为具有可变文件名的.text.目前,我正在使用功能dlmwrite(name,matrix);保存文件.这仅适用于预设的文件名.有没有一种方法可以使文件名可变?

I want to save a matrix as .text with a variable filename. Currently I'm saving my file using the function dlmwrite(name,matrix); This is only working with a pre-set filename. Is there a way to make the name of the file variable?

一个弹出的窗口要求打开一个文件名,就像'Uigetfile'与打开文件一样.有人知道Matlab是否具有与编写文本文件一样的功能吗?

A window that pops up that ask for a filename to write to just as 'Uigetfile' does with opening a file would be ideal. Does anyone know if Matlab got a function just like that for writing text files?

推荐答案

您可以使用

You can use uiputfile to graphically get the file name. For example:

[filename, pathname, filterindex] = uiputfile('', 'Select file');

然后使用dlmwrite将变量(例如data)保存到该文件:

Then use dlmwrite to save a variable, say data, to that file:

dlmwrite(fullfile(pathname, filename), data)

这篇关于保存文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆