필터 지우기
필터 지우기

Hi everyone! I need your help.

조회 수: 1 (최근 30일)
Engdaw Chane
Engdaw Chane 2018년 2월 13일
답변: Birdman 2018년 2월 13일
I have the following matrices:
Mat_A=194 x 201 x 360 rows, columns and monthly value respectively
Mat_B= 194 x 201 x 30 rows, columns and seasonal value respectively
I need to divide selected monthly values (from April to September) from Mat_A by Mat_B (seasonal value).
I tried the following:
Year=1:30;
April=(year-1)*12+3;
Sept=(year-1)*12+9;
for h =1:length(Mat_A)
for k= Mat_B(:,:,1:36)
Mat_C(h)= Mat_A(:,:,April:Sept)./ Mat_B(:,:,:)
end
end
I tried different ways, and couldn’t fix it. For this code, I am getting “Subscript indices must either be real positive integers or logicals.” error. Thank you.
Kindly, Engdaw

채택된 답변

Birdman
Birdman 2018년 2월 13일
Adapt this into your problem:
A=randi([1 5],194,201,360);
B=randi([1 5],194,201,30);
for i=120:270
A(:,:,i)./B(:,:,1:30);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by