Operators "concatenation" ?

조회 수: 1 (최근 30일)
Nicolas Douillet
Nicolas Douillet 2020년 5월 4일
댓글: Nicolas Douillet 2020년 5월 4일
Hi,
Is there a way to "concatenate" two or more Matlab operators while chaining several operations ?
For instance, I have a complex function returning a cell array :
C = my_complex_function(input)
And in the following, in another function I would like to perform for instance :
T = unique([C{:}]);
But via a direct call to the first function*, meaning I would like to avoid to create the temporary variable C in these latter function (the goal is to do it in one step instead of two or more).
Is it possible ? Do you know a way to do this ? (Of course I mean without mofifying the first function at all, including its return type)
* The idea is something like
T = unique([my_complex_function(input){:}])
Thanks for any help.

채택된 답변

James Tursa
James Tursa 2020년 5월 4일
No. MATLAB syntax does not allow using ( ) or { } right after a function call. You could of course create a third function to do these two steps behind the scenes if you wanted.
  댓글 수: 1
Nicolas Douillet
Nicolas Douillet 2020년 5월 4일
Ok thank you, this is also what I figured out.
If it wasn't the case I guess the language possibilities would be too complex and maybe also too messy.
I will then do it in two steps.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by