I know this is quite simple but I am drawing a blank on how to do it. I have an array that is titled t_yr and is (84x30x30), I need to add 120 to each element in the third dimension. Thank you in advance.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 4월 27일

0 개 추천

There is no difference between adding to each element in the third dimension compared to adding to every element. Not unless you meant something like adding 120 times the page number.
new_t_yr = bsxfun(@plus, t_yr, 120*reshape(1:size(t_yr,3), 1, 1, []));

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

질문:

2018년 4월 27일

답변:

2018년 4월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by