필터 지우기
필터 지우기

Calling a Function From Another Function

조회 수: 2 (최근 30일)
Rafael
Rafael 2017년 12월 7일
댓글: per isakson 2017년 12월 8일
I created a function called table(data) which returns a matrix with labels from the data. I would like to try and create another function which can use table(data). The reason I would like to learn this is because if I create a new function it will have to be by using just data again. I would like to use the new created data in future functions and scripts.
This is what I though I would work which it didn't.
function []=food(table(data))
However, that doesn't work because it returns unbalanced or unexpected parenthesis or bracket.
  댓글 수: 5
per isakson
per isakson 2017년 12월 8일
The statement "I created a function called table(data) which returns a matrix" confuses me.
T = table( data );
returns a table object, not a matrix. Thus I assumed that you had used the name table for your own function.
Stephen23
Stephen23 2017년 12월 8일
편집: Stephen23 2017년 12월 8일
"I read that page, although it doesn't show me what I want to learn. Is not even including ''functions'' in their tutorial."
This is the first page returned when I searched for "MATLAB functions":
It took me 0.5 seconds to locate.

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

답변 (1개)

per isakson
per isakson 2017년 12월 8일
편집: per isakson 2017년 12월 8일
M = table_1( data );
food( M );
or
food( table_1( M ) );
The two line construct is easier to debug
where
function food( m )
% m is a numerical matrix
...
end
  댓글 수: 8
Rafael
Rafael 2017년 12월 8일
I changed it to table_1. Now, how can work with it on a new function.
per isakson
per isakson 2017년 12월 8일
I changed my answer back to the original one, which shows the syntax you are asking for.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by