How can I edit my app?

4 views (last 30 days)
Muazma Ali
Muazma Ali on 25 Feb 2024
Answered: Shubham on 9 Oct 2024
Hi! :)
Do I need a while loop somewhere?
Seems the values for the table osmotic data aren’t saved in my table columns when I run the app?
I think there is something missing in tester_app_3 which I can’t see.
Do I need a loop to accumulate the column values in osmotic data, I just get the last value printed. It also seems that the program doesn’t start on zone nr 1 when I start the app again though I have deleted the previous files by writing the syntax delete(file).
I have matlab 2018
I am not sending the functions that are needed to run the app and neither the other app required to run the app since they are many functions and the problem is in tester_app_3.

Answers (1)

Shubham
Shubham on 9 Oct 2024
Hi Muazma,
From what I gather, you are encountering the following issues in your app:
  • Data not accumulating in table
  • Zone number not being reset
  • File deletion
Addressing the first concern, the table "Osmotisk_data" is being overwritten in each iteration of loop. To accumulate data, append new rows to existing table rather than overwriting it.
if app.error_osm == 0
% Append new row to the table instead of overwriting
newRow = {app.zone_now, app.combinations_of_salts, app.vekt_prosent_best_salt_1, app.vekt_prosent_best_salt_2, app.samlet_vannaktivitet, app.Osmotic_pressure};
app.Osmotisk_data = [app.Osmotisk_data; newRow];
end
For your second and third issues, ensure that "app.zone_now" is initialized correctly when the app starts. It should start at 1 and increment with each iteration. For file deletion, ensure it is executed only once, preferably at the start of the app, to prevent unintended deletions
function startupFcn(app, app2)
app.Callingapp = app2;
app.zone_now = 1; % Initialize zone_now here
% Ensure the file is deleted at the start
if exist('Osmotic_data.xls', 'file') == 2
delete('Osmotic_data.xls');
end
end
Hope this helps.

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!