データフレーム型を条件抽出して,時系列データの作り方
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
下のデータフレーム型のデータにおいて,8以下の要素だけ抽出したいのですが,コードの打ち方がわかりません.
教えていただければ幸いです.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1342399/image.png)
0 Kommentare
Antworten (1)
covao
am 23 Apr. 2023
Bearbeitet: covao
am 23 Apr. 2023
% 6列、10行のTable型データ作成、1から20までの乱数
dataTable = array2table(rand(10, 6)*20)
% 8以下のデータがある要素を抽出
dataArray = table2array(dataTable);
p = find( dataArray <= 8);
newData = dataArray(p)'
% 抽出した要素以外をNaNに置き換え
newVar = NaN(size(dataArray));
newVar(p) = dataArray(p);
newTable = array2table(newVar)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!