how I can delete value from an array?

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..

 採用された回答

Matt J
Matt J 2021 年 6 月 30 日
編集済み: Matt J 2021 年 6 月 30 日

0 投票

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 件のコメント

Aqeel Awan
Aqeel Awan 2021 年 6 月 30 日
not working
Matt J
Matt J 2021 年 6 月 30 日
but I showed you that it does!
Aqeel Awan
Aqeel Awan 2021 年 6 月 30 日
done .. thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Types についてさらに検索

質問済み:

2021 年 6 月 30 日

コメント済み:

2021 年 6 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by