Unit conversion using switch case or else if functions
Afficher commentaires plus anciens

Im supposed to use the switch case method or the else if method to solve this question. Anyone has any ideas on how to solve this?
5 commentaires
dpb
le 12 Fév 2020
More important are your ideas...make a start and show us what you've done so far and then ask a specific question if/when you get stuck.
Melvinder Singh
le 12 Fév 2020
Melvinder Singh
le 12 Fév 2020
Réponses (1)
Srivardhan Gadila
le 17 Fév 2020
For "Like to make it in such a way that I only need to input the starting value and unit together and not separately" you can make use of strsplit, str2num functions as follows:
valuePlusUnit = "45.3245 ft3";
stringSplit = strsplit(valuePlusUnit);
value = str2num(stringSplit(1))
units = stringSplit(2)
Catégories
En savoir plus sur Get Started with MATLAB dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!