Question: need to correct code for required output sexagForm = input ('Enter an azimuth value (sexagesimal form): ' ); delims = [ char (99) , '
need to correct code for required output
sexagForm = input ('Enter an azimuth value (sexagesimal form): ' ); delims = [ char (99) , ' ' , ' ' ] ;-.. parts = strsplit (sexagForm, delims , 'CollapseDelimiters', true); parts = (parts); upperLim -length (parts) templateStr 'Part %02d: %0.3f"; for i1:upperLim cva1 = parts (i); toDisplay sprintf (templateStr, i, cVal); end divideBy [1, 60, 3600] ; divisionResult= parts() / divideBy; converted = sum (divisionResult); templatestr- 'The decimal representation is %0.6f" toDisplay= sprintf(templateStr, converted); disp(toDisplay) ; Required Output A Command Window Enter an azimuth value (sexagesimal form): 120 30'46" Part ol: 120 Part 02: 30 Part 03: 46 The decimal representation is 120.512778 >> sexagForm = input ('Enter an azimuth value (sexagesimal form): ' ); delims = [ char (99) , ' ' , ' ' ] ;-.. parts = strsplit (sexagForm, delims , 'CollapseDelimiters', true); parts = (parts); upperLim -length (parts) templateStr 'Part %02d: %0.3f"; for i1:upperLim cva1 = parts (i); toDisplay sprintf (templateStr, i, cVal); end divideBy [1, 60, 3600] ; divisionResult= parts() / divideBy; converted = sum (divisionResult); templatestr- 'The decimal representation is %0.6f" toDisplay= sprintf(templateStr, converted); disp(toDisplay) ; Required Output A Command Window Enter an azimuth value (sexagesimal form): 120 30'46" Part ol: 120 Part 02: 30 Part 03: 46 The decimal representation is 120.512778 >>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
