Write a script that will first initialize a string variable
Write a script that will first initialize a string variable that will store x and y coordinates of a point in the form \'x 3.1 y 6.4\'. Then, use string manipulating functions to extract the coordinates and plot them.
Solution
a=input(\'Enter the X-coordinate:\');
b=input(\'Enter the Y-coordinate:\');
coord =\'x %.1f y%.1f\';
str = sprintf(coord,a,b);
nums=sscanf(str,\'%*s%f%*s%f\');
plot(nums(1),nums(2),o);
xlabel(\'X Coordinate\');
ylabel(\'Y Coordinate\');
