Is it possible to apply a vector function to each element of an array?
조회 수: 2 (최근 30일)
이전 댓글 표시
I mean, the output of my function is a vector, always the same size. So I want to apply this function to each element of an array, and get a higher dimension array or get a bigger array similar to the output of repmat().
댓글 수: 0
채택된 답변
Walter Roberson
2017년 5월 20일
temp = arrayfun(@yourFunction, TheArray, 'Uniform', 0);
output = reshape(cat(1,temp{:}),size(temp,1),size(temp,2),[]);
... you were not clear as to whether your vectors are row vectors or column vectors, and you were not clear as what shape of output you wanted.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!