meas is unrecognized, attempting to read in a file and plot data

I am attempting to follow https://www.mathworks.com/help/stats/clustering-using-gaussian-mixture-models.html with my own data. My data is x values (10 rows of double numbers) and y values (2 columns of double numbers). So I have this...
load p2-data
X = meas(:,1:2)
[n,p] = size(X)
plot(X(:,1),X(:,2),'k*','MarkerSize',15)
title('test')
xlabel('x points')
ylabel('y points')
However, I get the error: Unrecognized function or variable 'meas'
when running the above code. I am using R2020b. meas does seem to be a function. What am I doing wrong?

10 Comments

hello
what do you get in the worspace after load p2-data ?
type : who
Hi.
p2_data shows up in my workspace as a double (class), 10x2 (size), and 10x2 double (value). When I enter 'who', after only entering 'load p2-data', I get the following:
Your variables are:
p2_data
Also, when I run:
load p2-data
X = meas(:,1:2)
[n,p] = size(X)
plot(X(:,1),X(:,2),'k*','MarkerSize',15)
title('test')
xlabel('x points')
ylabel('y points')
In addition to the error: the error: Unrecognized function or variable 'meas'
I also get as a suggestion:
Did you mean:
X = mean(:,1:2)
hello
you are attempting to plot a variable (meas) that does not exist in your workspace
when you load your file, the data name is p2_data and not meas
so you have to correct : X = p2_data(:,1:2)
Awesome, thank you! That worked. I misunderstand that line. It seemed to be calling a function meas, in the example I was following. I'll keep going thru the example.
I looked for the option to accept this answer but I don't see it.
Make sure you are logged in. If the question has already been closed you will see "Accepted Answer by ____" to the right of your profile picture where the question is asked. If not, then look next to the profile picture of the answerer(s). To the right of each person's answer, in green, you should see a box that says "Accept this answer." Push that button
Don't know what the issue is but I am logged in. I can see my initials in the avatar. Plus I just logged in. However, I don't see the accept this answer option.
Mathieu wrote the solution here, which is the comments section. I suggest Mathieu put his answer properly so that Sunshine can accept it.

Sign in to comment.

 Accepted Answer

so the answer is :
you are attempting to plot a variable (meas) that does not exist in your workspace
when you load your file, the data name is p2_data and not meas
so you have to correct : X = p2_data(:,1:2)
enjoy !

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!