I want when index increase no. of layers should give inf or button disable to not accept more inputs,thanks
    1 visualizzazione (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    m.montaser sabry
 il 11 Dic 2024
  
    
    
    
    
    Spostato: Walter Roberson
      
      
 il 13 Dic 2024
            function ButtonPushed(app, event)
L = app.nooflayerEditField.Value;
r = zeros(L,1);
for i=1:L
    if i > L
        app.Button.Enable = off;  
        app.firstValEditField.Value= inf;
    end  
    app.Button.Enable ='Off';
    waitfor(app.firstValEditField.Value);
    r = app.firstValEditField.Value;
    r(i) = r;
    app.Button.Enable ='On'; 
end     
disp(r(i))
0 Commenti
Risposta accettata
  Walter Roberson
      
      
 il 11 Dic 2024
        for i=1:L
    if i > L
        app.Button.Enable = off;  
        app.firstValEditField.Value= inf;
    end  
When you have for i=1:L it is not possible for i to exceed L (unless you specifically assign to i). So it is not possible for the test if i > L to succeed.
    app.Button.Enable ='Off';
If the test somehow did succeed, then the first thing you would do after the if block would be to set app.Button.Enable back to 'off', which is a bit pointless.
    waitfor(app.firstValEditField.Value);
app.firstValEditField.Value is a numeric value. You cannot waitfor() a numeric value.
If you wanted to wait until app.firstValEditField is deleted, you would
    waitfor(app.firstValEditField);
If you wanted to wait until app.firstValEditField.Value changed then you would
     waitfor(app.firstValEditField, 'Value');
A problem with waiting for it to change is that if user wants to retain the current value, there is no way to do that.
7 Commenti
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Startup and Shutdown in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

