Error invalid expression input variable

10 views (last 30 days)
%% Posible questios for Covid Project
%%If everyone got vaccienated how will it affet the death rates
%%If no one got vaccinated compare both.
%%How has social life affected death rate in different age groups below 50's ish
prompt= "Length of simulation in days: ";
x=input(prompt);
Unable to run the 'fevalJSON' function because it calls the 'input' function, which is not supported for this product offering.
people="Number of new people per day: ";
N=input(people);
gp=3.42;%gestation period
tvs=8; %% average recovery period in days for vaccinated person
tus=14; %% average recovery period of unvaccinated person in days
tHv=5.6; %average time in the hopsital for vaccinated person
tHu=6.7;% average time in the hospital for unvaccinated person
%to=zeros(1,x); %% Total old
%ta=zeros(1,x); %% total adult
%ty=zeros(1,x); %% total young
%% For Old
fprintf("This part of the simulation is for old people above 65 years old \n");
u=zeros(1,x);%% inital people unvaccinated who get the vaccine
up="inital people unvaccinated who get the vaccine: ";
u1=input(up);
r=zeros(1,x);%% initial peope who reject vaccine
rp="initial people who reject the vaccine: ";
r(1)=input(rp);
H=zeros(1,x);
H(1)=u(1)+r(1);%% total initial population
fprintf("Total population for simulation is %d \n", H(1))
rr="Fraction of people who refuse vacciantion: ";
avgr=input(rr);
q1=(1-avgr)*N;%% peopel who accept the vaccine
q2=avgr*N;%people who refuse the vaccine;
This is the code I used, however in the line (u1=input(up);) it says invalid expresssion. I don't understand why it is an invalid expression though.

Accepted Answer

Star Strider
Star Strider on 11 Nov 2022
If you’re only running it using the online Run feature here, note that the online Run feature doesn’t support any interactive functions. Running it offline (on your wn computer) would probably work, and run without error.
(I generally prefer the inputdlg funciton to input, however it will also not run with the online Run feature.)
  2 Comments
Michael Kugelman
Michael Kugelman on 11 Nov 2022
Oh ok, was trying it on the online. I'll try it on the offline thank you.
Star Strider
Star Strider on 11 Nov 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!