How can I transfer data from an UItable to de app code? in order to use that data for another calculus
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Giulia Di Giorgio
 el 10 de Mzo. de 2023
  
    
    
    
    
    Comentada: Giulia Di Giorgio
 el 17 de Mzo. de 2023
            Hi, I created an UI table on the app I'm coding but I'm having multiple issues. I want to plot that data, also use it for another calculus and I want to launch warning messages when wrong data is given by the user, but when I run the app it shows no errors but does nothing with the data I gave it, I'm suspecting I need tu use the "catch" command but I'm not sure, and I a don't know how to use it either. I'll attatch code and picture. Thx.

global tabla
            tabla=app.UITable.Data;
            h=cell2mat(tabla(:,1))
            tP=cell2mat(tabla(:,2))
            tT=cell2mat(tabla(:,3))
            Knob=app.Knob.Value;
            switch Knob
                case 'Q vs t (parciales)'
                plot(app.UIAxes,h,tP) 
            end
switch true
                case tabla < 0
                f=warndlg('Tanto las alturas (cm) como los tiempos (s) deben ser mayores a 0')
end 
0 comentarios
Respuesta aceptada
  Amal Raj
    
 el 13 de Mzo. de 2023
        Hi Giulia
global tabla
tabla = app.UITable.Data;
h = cell2mat(tabla(:,1));
tP = cell2mat(tabla(:,2));
tT = cell2mat(tabla(:,3));
if any(tabla < 0)
    f = warndlg('Tanto las alturas (cm) como los tiempos (s) deben ser mayores a 0');
end
if strcmp(app.Knob.Value, 'Q vs t (parciales)')
    plot(app.UIAxes, h, tP);
end
I replaced the switch statement with an if statement that checks if the 'Knob' variable equals a specific value. I also used the 'any' function to check if any element of 'tabla' is less than zero in the second switch statement.
Más respuestas (0)
Ver también
Categorías
				Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

