AA = csvread('temp.csv');
YA = unique(AA(:,1));
GA = findgroups(AA(:,1));
SA = splitapply(@max,AA(:,4:13),GA);
AM = [YA SA];
I am trying to get annual maximum value for the given data but i am getting this error while running the code. The code is working perfectly fine for my other station data. Help me
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
Error in splitapply>localapply (line 253)
finalOut{curVar} = vertcat(funOut{:,curVar});
Error in splitapply (line 132)
varargout = localapply(fun,splitData,gdim,nargout);

 채택된 답변

Jan
Jan 2021년 3월 16일
편집: Jan 2021년 3월 16일

0 개 추천

@max calculates the maximum over the 1st non-singleton dimension. If the input is a matrix, this is the first dimension, but if a row vector is applied, it is the 2nd dimension. So you have to specify the dimension explicitly:
SA = splitapply(@(x) max(x, [], 1), AA(:, 4:13), GA);

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Data Preprocessing에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2021년 3월 16일

댓글:

2021년 3월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by