Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(MATLAB) Write a function that will read data from the attached \"XY.dat\". This

ID: 1840683 • Letter: #

Question

(MATLAB)
Write a function that will read data from the attached "XY.dat".
This data file has a header line.
The format of every line in the file is the letter ‘x’, a space, the x value, space, the letter ‘y’, space, and the y value.
x 0 y 1
x 1.3 y 2.2

The function has one input argument: the file path of the data file. The function will attempt to open the data file and errorcheck to make sure it was opened. If so, it reads in all x values and y values. Then the function closes the file.
The function shall return the x and y vectors as the output arguments.

Explanation / Answer

%Matlab code here function [x,y]=read('path') A=importdata(path); x=A.data(:,1); y=A.data(:,2); end