Having trouble accesing data through an API
Show older comments
Building an app in Matlabs app desgin. Im want to have the code find the country, selected by the user, and populate information about the country. I kep recieving this error about dot indexing.
app.data = webread('https://restcountries.com/v3.1/all');
app.Country_Select.Value = 'Jordan'
selectedCountry = app.Country_Select.Value;
% Find the index of the selected country in the data
n = find(strcmp(app.data.name.common, selectedCountry));
if isempty(n)
% Country not found in data, handle the error gracefully
app.clearUIFields();
return;
end
Accepted Answer
More Answers (0)
Categories
Find more on Develop Apps Using App Designer 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!