Is it possible to set a vector as an users input'
Afficher commentaires plus anciens
I want to obtain a vector as an input whit some value for each month of the year. So i did this way
while true %January [kwh]
TECJan=input("Feb [kwh] ");
if isnumeric(TECJan)
break
end
end
while true %February [kwh]
TECFeb=input("Feb [kwh] ");
if isnumeric(TECFeb)
break
end
end
while true %March [kwh]
TECMar=input("Mar [kwh] ");
if isnumeric(TECMar)
break
end
end
while true %April [kwh]
TECApr=input("Apr [kwh] ");
if isnumeric(TECApr)
break
end
end
while true %May [kwh]
TECMay=input("May [kwh] ");
if isnumeric(TECMay)
break
end
end
while true %June [kwh]
TECJun=input("Jun [kwh] ");
if isnumeric(TECJun)
break
end
end
while true %July [kwh]
TECJul=input("Jul [kwh] ");
if isnumeric(TECJul)
break
end
end
while true %August [kwh]
TECAug=input("Aug [kwh] ");
if isnumeric(TECAug)
break
end
end
while true %September [kwh]
TECSep=input("Set [kwh] ");
if isnumeric(TECSep)
break
end
end
while true %October [kwh]
TECOct=input("Oct [kwh] ");
if isnumeric(TECOct)
break
end
end
while true %November [kwh]
TECNov=input("Nov [kwh] ");
if isnumeric(TECNov)
break
end
end
while true %December [kWh]
TECDec=input("Dec [kwh] ");
if isnumeric(TECDec)
break
end
end
TEC_Mm=[TECJan,TECFeb,TECMar,TECApr,TECMay,TECJun,TECJul,TECAug,TECSep,TECOct,TECNov,TECDec];
It works for me, but i was wondering if ther is an easy way , for example ask directly for vector elements as inputs, whit the possibility to ask only one time the whole elements of TEC_Mm
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Time Series Objects dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!