Unable to perform assignment because the left and right sides have a different number of elements.

1 view (last 30 days)
I am trying to build an array for calculating wind-gust factor ratios for different averaged time intervals and I am running into the error as described in the title of this post.
Script:
numdata = length(wspd);
numgusts = floor(numdata/600);
g3_60 = zeros(numgusts,1);
g3_600 = zeros(numgusts,1);
g60_600 = zeros(numgusts,1);
for qq = 1:numgusts
sp = 1 + (qq-1)*600;
ep = qq*600
g3_60(qq) = max(wspd3(ep:sp)) / max(wavg1(ep:sp));
g3_600(qq) = max(wspd3(ep:sp)) / W10(ep);
g60_600(qq) = max(wavg1(ep:sp)) / W10(ep);
end
For context, wspd3 is 3-sec averages or 3 data points for a file with data every second, wavg1 is 1 min data or 60 points, and W10 is 10 min data or 600 points. numdata = 43201 and numgusts = 72
I would appreciate any advice/answers! Thank you so much for your time!

Accepted Answer

DGM
DGM on 27 Oct 2022
Your array indexes are backwards, so the RHS is zero-length
g3_60(qq) = max(wspd3(sp:ep)) / max(wavg1(sp:ep));
I don't know which index you intend to use in the indexing of W10.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!