table内のデータの分類
Show older comments
cellnumber x-coordinate y-coordinate z-coordinate velocity-magnitude x-velocity y-velocity
1 7.247862965E-02 -3.402025031E-04 2.570709270E-12 7.933211766E-02 7.923561806E-02 -3.726211967E-03
2 7.170525193E-02 -6.271004095E-04 5.697930409E-12 8.309464250E-02 8.295612354E-02 -3.294266419E-03
3 7.091022283E-02 3.900840602E-05 5.133317382E-12 8.667398612E-02 8.650423325E-02 -1.838252872E-03
4 7.108189911E-02 1.132128891E-04 5.564271700E-12 8.754849331E-02 8.752092725E-02 -8.803451647E-04
5 7.123809308E-02 -8.779050404E-05 4.924587214E-12 8.451820225E-02 8.443262162E-02 -3.524512011E-03
6 7.189998776E-02 -7.133460604E-04 3.575246653E-12 8.540739507E-02 8.521852355E-02 -3.733413298E-03
7 7.246583700E-02 -3.925653000E-04 2.149904820E-12 8.007377451E-02 8.004747283E-02 -8.047809784E-04
8 7.185348123E-02 1.993447077E-04 4.849499708E-12 8.453633833E-02 8.453421366E-02 -2.342070785E-04
9 7.206586748E-02 -7.203953373E-06 5.846841674E-12 8.052642545E-02 8.051374435E-02 1.188734314E-04
10 7.229216397E-02 -1.445028320E-04 6.496133492E-12 8.052642545E-02 8.051374435E-02 1.188734314E-04
初めてMATLABを使用するのですが、このような.txtのデータを読み込んで、x座標が特定の範囲内(2.4E-02<x<4.6E-02など)のデータのみ抽出したいと考えております。
データを読み込んでから、特定の範囲内のデータを抽出する方法がわかりません。
(R2020b使用)
clear;close all;clc;
% 解析準備
listtif = dir('*.txt');
names = {listtif.name};
number = numel(listtif);
% 解析シークエンス
for q = 1:1:number
% データの読み込み
celldata = readtable(names{q});
% 座標・速度の抽出
x = celldata.x_coordinate;
vel_x = celldata.x_velocity;
vel_y = celldata.y_velocity;
% 各セルの設定
x_1 = 0.024 < x & x < 0.046;
x_2 = 0.048 < x & x < 0.070;
x_3 = 0.072 < x & x < 0.094;
x_4 = 0.096 < x & x < 0.118;
% データの分類
???
...分析処理...
end
matlabのヘルプセンターの「table内のデータへのアクセス」は確認したのですが、参照できませんでした。
もしわかる方がいらっしゃいましたら、ご教示いただけると幸いです。
Answers (0)
Categories
Find more on MATLAB 入門 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!