필터 지우기
필터 지우기

How to pass contents of cell array to a function?

조회 수: 2 (최근 30일)
snowflake
snowflake 2019년 1월 4일
댓글: madhan ravi 2019년 1월 4일
I have
function [S , U ] = HOSVD ( A )
where U is a cell array of length 3
and I would like the function to return each cell. I tried
function [S , U{1}, U{2}, U{3} ] = HOSVD ( A )
but it doesn't work, it gives an error regarding the brackets.
How should I write it?

답변 (1개)

madhan ravi
madhan ravi 2019년 1월 4일
  댓글 수: 7
snowflake
snowflake 2019년 1월 4일
Nevermind, I just used cell2mat to convert those cell arrays and properly put them in the function def, thank you
madhan ravi
madhan ravi 2019년 1월 4일
alternatively you can use
vertcat(U{:})

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by