Create a static text box that displays a number, then adds one every time the GUI is opened.
1 次查看(过去 30 天)
显示 更早的评论
I am trying to create a static text box that displays the value 'R0000001'. Then from that point on, every time the GUI opens or the "New" option from the tool bar is clicked the static text box displays the next value up.
For example when I open the GUI for the first time the static text box displays 'R0000001'. Then I choose "New" it will display 'R0000002'.After that I close it and reopen it again it will display "R0000003' ... and so on.
This GUI will be compiled to be a standalone application to be used by users that do not have MATLAB installed.
Is this possible?
0 个评论
采纳的回答
Azzi Abdelmalek
2013-5-23
In your opening function
s=char(get(handles.text1,'string'));
n=num2str(str2num(s(2:end))+1);
s(end-numel(n)+1:end)=n
set(handles.text1,'string',s)
3 个评论
Azzi Abdelmalek
2013-5-23
No, use a mat-file
In windows command, create a mat-file
s='R0000001'
save filename s
In your opening function
s=load('filename');
s=s.s
n=num2str(str2num(s(2:end))+1);
s(end-numel(n)+1:end)=n
set(handles.text1,'string',s)
save filename s
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!