Matlab自动生成变量名并保存到文件
我有一个 Matlab 应用程序,可以根据用户输入生成输出矩阵。我想将其保存到一个或多个文件中。我想到的有两种方法:
多个文件;每个文件一个矩阵
user1.mat
user2.mat
....
具有多个矩阵的单个文件 allUser.mat
user1=[data1]
user1=[data2]
....
但是我不知道如何跟踪数字,因为每个用户都会启动应用程序的新实例。知道如何做到这一点吗?
I have a Matlab application that generates a output matrix based on user input. I want to save it to a file or files. There are two ways I have in mind:
Multiple files; one matrix per file
user1.mat
user2.mat
....
Single file allUser.mat
with multiple matrix
user1=[data1]
user1=[data2]
....
However I don't know how to keep track of the number, because every user will start a new instance of the application. Any idea how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种方法是简单地编辑(或创建,如果尚不存在)
startup.m
文件来询问用户的用户 ID,然后使用该文件加载正确的文件:另一种方法是如果每个用户使用自己的登录,则使用 unix
whoami
函数:One way is to simply edit (or create, if it's not there already) the
startup.m
file to ask the user for their user id, and then use that to load the correct file:Another way would be to use the unix
whoami
function, if each user uses their own logon: