Borrar filtros
Borrar filtros

Create a static text box that displays a number, then adds one every time the GUI is opened.

1 visualización (últimos 30 días)
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?

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 23 de Mayo de 2013
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 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 23 de Mayo de 2013
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming Utilities en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by