Unit conversion using switch case or else if functions
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen

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 Kommentare
Antworten (1)
Srivardhan Gadila
am 17 Feb. 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)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!