how I can delete value from an array?

1 Ansicht (letzte 30 Tage)
Aqeel Awan
Aqeel Awan am 30 Jun. 2021
Kommentiert: Aqeel Awan am 30 Jun. 2021
m=4;node_tk=2;node=[];a=0;
for i=1:m
a=a+1;
node(a,:)=i;
end
for i=1:m
if node_tk== node(i)
delete node(i);
end
end
display(node)
i want to delete node_tk value from an array..

Akzeptierte Antwort

Matt J
Matt J am 30 Jun. 2021
Bearbeitet: Matt J am 30 Jun. 2021
m=4;node_tk=2;
node=1:m,
node = 1×4
1 2 3 4
node(node_tk==node)=[]
node = 1×3
1 3 4
  3 Kommentare
Matt J
Matt J am 30 Jun. 2021
but I showed you that it does!
Aqeel Awan
Aqeel Awan am 30 Jun. 2021
done .. thank you

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by