Reputation: 316
I'm a complete Matlab newbie, so please bear with me :) I'm using my friend's vague instructions, so I don't if they are correct.
I have variable named m12 (imported form an .xls file), which is an 61x3 array. No labels.
The first column contains leverages, the second standardised residuals for the training (first 46 rows) and validation (remaining 15 rows) sets of a PLS model.
I want to group those first two columns, so that the training set is represented by blue 'X', and validation set by red 'O', so I put 46 rows of '1's and next 15 rows '2's in the third column.
My friend told me to simply type:
group(:,3)
gscatter(m12(:,1), m12(:,2), group, 'br', 'xo')
but when I type
group(:,3)
I get an "??? Undefined variable group." error.
Can anyone help me?
Upvotes: 0
Views: 4122
Reputation: 74940
Just write
group = m12(:,3);
instead of your first line.
This way, you're defining a vector group
that contains all the entries of the third column of m12
, i.e. your grouping variable.
Upvotes: 3