Labelling multiple coordinates for later functions

Hi
Im trying to figure out a way to give my data which is a series of 12 different coordinates 'labels' to be able to use thos labels in further functions.
For example i want to label
p1 = [3.61 0.36] as (x1) and (y1)
p2 = [1.51 3.65] as (x2) and (y2)
p3 = [2.69 0.7] as (x3) and (y3)
p4 = [1.98 4.72] as (x4) and (y4)
e.c.t

 Akzeptierte Antwort

Matt J
Matt J am 19 Aug. 2020
Bearbeitet: Matt J am 19 Aug. 2020
When you say "label", I think you really mean "index". To achieve that, bundle your data into appropriate matrices:
p=[ 3.61 0.36;
1.51 3.65;
2.69 0.7;
1.98 4.72]
x=p(:,1); y=p(:,2);
and now you can do, for example,
>> p(1,:)
ans =
3.6100 0.3600
>> x(3)
ans =
2.6900
>> y(4)
ans =
4.7200

3 Kommentare

Thank you ver much for your help
*very
Matt J
Matt J am 19 Aug. 2020
You're welcome, but please Accept-click the answer, if it solved your problem.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Gefragt:

am 19 Aug. 2020

Kommentiert:

am 19 Aug. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by