Debugging in application problem
Mostra commenti meno recenti
Hello, I am having problems with my App while Debugging. In Figure-1, data and places seem to be empty, but this is not the case when I remove the breakpoint because it works well, so I had inserted a different breakpoint in an another function and I saw that everything is as it should be.(Figure-2). I can keep working on, but I think that I should post this.(I am very new to programming and Matlab, sorry for any mistakes in this post)


function StartupFcn(app)
load covid_data.mat covid_data
countries = string(unique(covid_data(2:end,1)));
M = splitapply(@(x) {x}, covid_data(2:end,2:end).', findgroups(covid_data(2:end,1).'));
app.Global = Object_constructor("Global");
app.Global.data = cell2mat(covid_data(2:end, 3:end));
app.Dates = string(covid_data(1,3:end));
app.Global.places = Object_constructor(countries);
for ii=1:numel(countries)
country_data = M{ii};
app.Global.places(ii).data = cell2mat(country_data(2:end,1));
app.Global.places(ii).data(1,3)= app.Global.places(ii).data(1,1);
app.Global.places(ii).data(1,4)= app.Global.places(ii).data(1,2);
for pp=1:size(country_data(2:end,1),1)-1
temp=app.Global.places(ii).data(pp+1,1)-app.Global.places(ii).data(pp,1);
temp2=app.Global.places(ii).data(pp+1,2)-app.Global.places(ii).data(pp,2);
if temp > 0
app.Global.places(ii).data(pp+1,3)= temp;
else
app.Global.places(ii).data(pp+1,3)=0;
end
if temp2 > 0
app.Global.places(ii).data(pp+1,4)= temp2;
else
app.Global.places(ii).data(pp+1,4)=0;
end
end
app.Global.places(ii).places = Object_constructor(string(country_data(1,2:end)));
for jj=1:size(country_data(1,2:end),2)
state_data = country_data(2:end, jj+1);
app.Global.places(ii).places(jj).data = cell2mat(state_data);
if isempty(app.Global.places(ii).places(1).name)
app.Global.places(ii).places(jj).data(1,3) = app.Global.places(ii).places(jj).data(1,1);
app.Global.places(ii).places(jj).data(1,4) = app.Global.places(ii).places(jj).data(1,2);
for pp=1:size(country_data(2:end,1),1)-1
temp = app.Global.places(ii).places(jj).data(pp+1,1) - app.Global.places(ii).places(jj).data(pp,1);
temp2 = app.Globa.places(ii).places(jj).data(pp+1,2) - app.Global.places(ii).places(jj).data(pp,2);
if temp > 0
app.Global.places(ii).places(jj).data(pp+1,3)= temp;
else
app.Global.places(ii).places(jj).data(pp+1,3)=0;
end
if temp2 > 0
app.Global.places(ii).places(jj).data(pp+1,4)= temp2;
else
app.Global.places(ii).places(jj).data(pp+1,4)=0;
end
end
end
end
app.HoleCases = sum(app.Global.data(:,1:2:end-1));% I insert breakpoint here and I cannot see the places and data as can be seen in the Figure-1
app.HoleDeaths = sum(app.Global.data(:,2:2:end));
app.CountryListBox.Items = ["Global",app.Global.places.name];
app.StateorRegionListBox.Items = "All";
app.AveragedofdaysSlider.Value = 1;
app.DailyData();
app.Country = 0;
app.CasesButton.Value = 1;
app.PlotCases();
end
end
2 Commenti
Ameer Hamza
il 11 Ott 2020
It depends on where you add the breakpoint. For example, these values are assigned in this for loop
for ii=1:numel(countries)
If you add a breakpoint before these values are assigned, you will get empty vectors.
Berkay Yaldiz
il 11 Ott 2020
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Startup and Shutdown in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!