How to add variable to Table in MatLab App Designer ?

Illustration
ryem berrada - 2023-12-05T14:46:06+00:00
Question: How to add variable to Table in MatLab App Designer ?

Hello,   I have a few variables that I would like to add into columns of a Table in MatLab App designer.   Ma variables are: app.A, app.B, app.C   I set the Table (called app.Table) to have 3 columns from the design view, but I can't figure out how to add my variables to it.   This is what I have to far:   app.Table{1}=(app.A); %gives me error 'Unable to perform assignment because brace indexing is not supported for variables of this type.' app.Table{2}=(app.B); app.Table{3}=(app.C);  

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

Try This:

 

properties (Access = public)
    t;
    A;
    B;
    C;
    
% Button pushed function: RunButton
        function RunButtonPushed(app, event)
                 %generate table           
                 app.t = [A' B' C']; %create matrix of table data
                 app.Table.Data = app.t; % Add data to the Table UI Component
        end

 % Cell edit callback: Table
        function TableCellEdit(app, event)
            app.Table=app.table(A,B,C,'VariableNames',{'A' 'B' 'C'});
        end

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!