Combining Tables Using App Designer

5 views (last 30 days)
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!

Accepted Answer

Erika Hathaway
Erika Hathaway on 6 Aug 2019
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 :)

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!