How to swap data variables in particular columns
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Stephen Devlin
am 29 Nov. 2017
Kommentiert: Stephen Devlin
am 29 Nov. 2017
Hi,
I have a large data set of repeated tests at different frequencies, when the measuring equipment has an issue and cannot measure correctly it sometimes records the results incorrectly: num freq value ___ ___ ____
1.00 10.00 1.10
10.00 2.00 2.30
3.00 10.00 NaN
4.00 10.00 9.30
5.00 10.00 2.66
6.00 10.00 0.71
10.00 7.00 2.22
8.00 10.00 6.02
9.00 10.00 9.90
10.00 10.00 104.00
i.e. num should go smoothly from 1:10 and the frequency for this table should all be 10KHZ. Is there a simple way to swap the values which are incorrect?
close all
clear all
clc
%some fake data to illustrate issue
A=(1:10)';
B=ones(10,1)*10;
C=[1.1,2.3,NaN,9.3,2.66,0.71,2.22,6.02,9.9,104]';
data=horzcat(A,B,C);
data(2,1)=10;
data(2,2)=2;
data(7,1)=10;
data(7,2)=7;
datatab=array2table(data);
vars={'num','freq','value'};
datatab.Properties.VariableNames=vars
at the moment I am splitting the data into separate frequencies so that they are all of the same frequency in each batch using a for loop and don't know where to go from there.
Best regards
Steve
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!