Error invalid expression input variable
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Michael Kugelman
le 11 Nov 2022
Commenté : Star Strider
le 11 Nov 2022
%% 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);
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.
0 commentaires
Réponse acceptée
Star Strider
le 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 commentaires
Star Strider
le 11 Nov 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!