MATLAB: Combining Tables Using App Designer

uitable

Hello!
Here's what I have:
  • A table n x 3, where the 1st column is strings, 2nd and 3rd is numbers.
  • A function that inputs the first three columns of an excel file into said table. I'll call this NewTable.
  • Three inputs, which I change into a 1 x 3 (table?) where the 1st column is a string, 2nd and 3rd are numbers. I'll call this NewEvent.
Here's what I want to do:
  • 1. I am trying to combine NewTable and NewEvent to make a Combined Table. NewTable is the UITable Handle
Combined_Table = [app.UITable.Data; NewEvent];
I run into the error that variables in NewTable and NewEvent must be the same.
  • 2. NewEvent is made of three variables 'Name' 'Start' 'End', which are the 1st, 2nd, and 3rd column respectively, so I am to make NewTable have the same variables. I don't actually know what variable NewTable has each column under. I can change the columnName, but that doens't do much other than change the display.
  • 3. My approach was to literally just separate the 1st 2nd and 3rd column of NewTable and set them as the three variables.
app.Name = app.UITable.Data(':,A');
app.Start = app.UITable.Data(':,B');
app.End = app.UITable.Data(':,C');
This obviously doensn't work, so any advice is appreciated!

Best Answer

Update:
I ended up solving this by taking the data out of the tables, combining them, then putting the new data back into the table.
% The original app.UITable.Data I renamed as OriginalData
OrigialData = get(app.UITable,'data');
Combined_Table = [OriginalData; NewEvent];
set(app.UITable,'data', Combined_Table);
I'm not a CS person yet, so I don't know what it changed, but it worked that way :)