extract matrix from matrix with the values of the axis

4 Ansichten (letzte 30 Tage)
Asliddin Komilov
Asliddin Komilov am 14 Aug. 2020
Kommentiert: KSSV am 14 Aug. 2020
x=linspace(0,8,91);
y=linspace(1,3,56);
I have a matrix DL1 (91x46) and need to extract DL2 =DL1(DL1<=2) and the values of the x and y axis from DL1 corresponding to DL2.
Please help

Akzeptierte Antwort

KSSV
KSSV am 14 Aug. 2020
Bearbeitet: KSSV am 14 Aug. 2020
[m,n] =size(DL1)
x=linspace(0,8,n);
y=linspace(1,3,m);
[X,Y] = meshgrid(x,y) ;
%
idx = DL1<2 ;
idx = idx' ;
iwant = [X(idx) Y(idx)]
  8 Kommentare
Asliddin Komilov
Asliddin Komilov am 14 Aug. 2020
or extract x and y values for the none NaN part of the DL2?
KSSV
KSSV am 14 Aug. 2020
X(~idx) = NaN ;
Y(~idx) = NaN ;

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by