help writing a script which outputs the daily percentage of positive COVID-19 cases

1 view (last 30 days)
Hello all,
I'm trying to write a script which gives the daily percentage of positive COVID-19 cases for Oregon. So far I have
%Analysis of daily percentage of positive COVID-19 test in the state of Oregon
clc
clear all
close all
%load data from https://covidtracking.com/data/state/oregon
api='https://covidtracking.com/api/v1/states/OR/daily.json'
data=webread(api)
This gives a 76x1 cell with all 1x1 structres. I would like to get the data from these structers so I can use the variables to produce a best fit using either one of the two equations 1/x/a/sqrt(2*pi)*exp(-(log(x)-b)^2/2/a^2) where a,b are variables.
  3 Comments
Rik
Rik on 21 May 2020
In response to your email: the preferred way is to leave a question as it was, instead of replacing it. Asking multiple questions is fine.
If you still have a copy of the original question text I don't see any issues with restoring it yourself. Otherwise you can leave it for a site admin to revert, but they are busy, so that can take up to several weeks to do.

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 19 May 2020
Edited: Ameer Hamza on 19 May 2020
This shows how to extract data from a particular field
api='https://covidtracking.com/api/v1/states/OR/daily.json';
data=webread(api);
dataTotal = cellfun(@(x) x.('total'), data);
dataPositive = cellfun(@(x) x.('positive'), data);
dataNegative = cellfun(@(x) x.('negative'), data);

More Answers (0)

Tags

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!