Remove zero velocities and its correnponding coordinates.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have 4 rows and 50,000 columns consisitng x-coordinates, y-coordinates, u-velocity, and v-velocity. So, u and v velocity are zero at some loactions and I want to get rid of those velocities and thier respective coordinates from the dataset to run my analysis.
Thank you
Risposte (1)
Pratheek
il 28 Mar 2023
% load the dataset to the variable data
data = [];
% extract the each column to a individual column vector
x = data(:, 1);
y = data(:, 2);
u = data(:, 3);
v = data(:, 4);
% creating a logical index for the rows where u and v are both non-zero
idx = (u ~= 0) & (v ~= 0);
% use the logical index to extract only the desired rows from the original dataset
x_new = x(idx);
y_new = y(idx);
u_new = u(idx);
v_new = v(idx);
% concatenating the filtered columns back into a single matrix
data_filtered = [x_new, y_new, u_new, v_new];
% to save the filtered dataset to a new csvfile
csvwrite('your_filtered_data_file.csv', data_filtered);
0 Commenti
Vedere anche
Categorie
Scopri di più su Filter Analysis in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!