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

 Risposta accettata

Matt J
Matt J il 19 Ago 2020
Modificato: Matt J il 19 Ago 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 Commenti

Thank you ver much for your help
You're welcome, but please Accept-click the answer, if it solved your problem.

Accedi per commentare.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by