Matlab excel sheet app.

1 view (last 30 days)
Adithya Narasimhan
Adithya Narasimhan on 5 Apr 2021
I am trying to make an matlab using app designer where if we press the read button it should create and new excel sheet and should display the data on the UI table. After that I tried to put some values on matlab edit field and created an add buttopn that show add my new data to the table sheet and should display it on the UI table. But I am unable to append data. I tried using writetable but it just overwrites my previous data. I need help in appending data to excel.
  1 Comment
Mario Malic
Mario Malic on 5 Apr 2021
Your question is not clear. What you should do is to load the table from Excel, display it in UITable component, make changes to UITable component in App Designer and write it back to Excel.
Otherwise, take a look at this example.

Sign in to comment.

Answers (1)

Pratheek Punchathody
Pratheek Punchathody on 8 Apr 2021
As per my understanding,
User has to enter the values in the edit field of the app and you need to take those inputs and append in the excel sheet which is already created. Also you need to read the updated data from the excel sheet and display it in the UITable.
For this, Initially let us consider that we are already having an existing excel sheet with 5 rows in it
Now that we have a new row of data stored in the form of 1x3 table - "newcolor" (data can be collected from the user input)
newcolor =
1×3 table
Var1 Var2 Var3
__________ __________ _________
{'purple'} {'800080'} {'False'}
Next step is to append the below data to the existing excel sheet. In this case I have considered "main.xls" as the existing excel sheet.
writetable(newcolor,'main.xls','WriteMode','Append','WriteVariableNames',false,'WriteRowNames',true)
After appending the data to the excel sheet below is the output we get.
Also you can refer to the documentation on Append Data to Bottom of Table using writetable. This has to be implemented with the UItable and push botton function.
Hope this helps..!

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!