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.