how to extract subset from dataset?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Welcome
I have a dataset of type "CSV" named "NF" in which there is a column of type Categorecal named "Attack" and it has five categories: 'Benign', 'Theft', 'DDoS', 'DoS', and 'Reconnaissance' .
I want to extract a new dataset from this dataset "NF" based on the value of the column "Attack" if it is only equal to 'DDoS'

採用された回答
Arif Hoq
2022 年 12 月 7 日
a=readtable("NF.xlsx");
aa=find(strcmp(a.Attack,'DDoS'));
aaa=a(aa,:)
aaa = 3×5 table
value del dys label Attack
_____ ___ ____ _____ ________
1 43 232 1 {'DDoS'}
3 4 2323 1 {'DDoS'}
34 6 2323 1 {'DDoS'}
11 件のコメント
mahmood aljamal
2022 年 12 月 7 日
I got this error
Attempt to execute SCRIPT readtable as a function:
D:\Polyspace\R2019b\toolbox\matlab\iofun\readtable.m
Arif Hoq
2022 年 12 月 7 日
possibly your file is in CSV format. try this. It would be better if you attach your file here.
a=readtable("NF.CSV");
mahmood aljamal
2022 年 12 月 7 日
My dataset file size is 47MB and I can't upload it here but I can give you a link to download it https://cloudstor.aarnet.edu.au/plus/s/N0JTc8JFNtZtUE4
If you can implement your code on it, please send me the dataset that you extracted
thank you very much
Arif Hoq
2022 年 12 月 7 日
I was able to run your CSV file. I have attached here the dataset.
a=readtable("NF-BoT-IoT.csv");
aa=find(strcmp(a.Attack,'DDoS'));
output=a(aa,:)
mahmood aljamal
2022 年 12 月 7 日
Thank you very much brother, you have been very helpful
mahmood aljamal
2022 年 12 月 7 日
Can you send a csv file?
Arif Hoq
2022 年 12 月 7 日
which CSV file? I have attached the dataset according to the CSV file that you uploaded to the cloud storage.
mahmood aljamal
2022 年 12 月 7 日
I mean the file you sent me with the mat extension. Can you send it in csv format?
Arif Hoq
2022 年 12 月 7 日
use this syntax to export in a CSV file.
loadmatfile=load("output.mat");
your_output=loadmatfile.aaa;
writetable(your_output,'mycsvfile.csv')
mahmood aljamal
2022 年 12 月 7 日
I got this error
Error using load
Unable to read file 'output.mat'. No such file or directory.
Arif Hoq
2022 年 12 月 7 日
check the 'output.mat' file in your matlab directory.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Downloads についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
