My Code is;
Ave3ON = zeros(size(S));Ave5ON = zeros(size(S));Ave7ON = zeros(size(S));AvethdON = zeros(size(S));Ave3OFF = zeros(size(S));Ave5OFF = zeros(size(S));Ave7OFF = zeros(size(S));AvethdOFF = zeros(size(S));for i=1:length(S) M3=([S(i).HV3]); M5=([S(i).HV5]); M7=([S(i).HV7]); Mthd = ([S(i).thd]); Ave3ON(i)=mean(M3(90000-S(i).date*1667:90000)); Ave5ON(i)=mean(M5(90000-S(i).date*1667:90000)); Ave7ON(i)=mean(M7(90000-S(i).date*1667:90000)); AvethdON(i)=mean(Mthd(90000-S(i).date*1667:90000)); Ave3OFF(i)=mean(M3(110000:110000+S(i).date*1667)); Ave5OFF(i)=mean(M5(110000:110000+S(i).date*1667)); Ave7OFF(i)=mean(M7(110000:110000+S(i).date*1667)); AvethdOFF(i)=mean(thd(110000:110000+S(i).date*1667));end
Error Message is;
Error using computeperiodogram>validateinputs (line 196)
The input must be either a vector or two-dimensional matrix.
Error in computeperiodogram (line 61)
[x1,~,y,is2sig,win1] = validateinputs(x,win,nfft);
Error in periodogram (line 215)
[Sxx,w2,RSxx,wc] =
computeperiodogram(x,win,nfft,esttype,Fs,options);
Error in thd>timeTHD (line 126)
[Pxx, F] = periodogram(x,w,n,fs,'psd');
Error in thd (line 89)
[r, harmPow, harmFreq] = timeTHD(plotType, harmType,
varargin{:});
Error in Untitled2 (line 28)
AvethdOFF(i)=mean(thd(110000:110000+S(i).date*1667));
Struct S =
480×1 struct array with fields:
name
date
HV3
HV5
HV7
thd
Best Answer