How to swap data variables in particular columns
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!