a function that takes a table as input and returns a table as output

40 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 6 月 18 日
コメント済み: alpedhuez 2020 年 6 月 18 日
Can one write a function that takes a table as an input and returns a table as an output?

採用された回答

Nipun Agarwal
Nipun Agarwal 2020 年 6 月 18 日
Hey,
Its completely possible to take the input as a table in MATLAB Function and return it as an output. I have written a code for your reference where I generate a random table, give it as an input in the function, change its value at cell 2 to 0 and return the modified table from the function.
Code: -
function table_output = myfunction(table_input)
table_input{2,2} = 0; %changing cell at 2,2 to 0
table_output = table_input; % returning the output
end
t = table(randn(3,1),randn(3,1),'VariableNames',{'X' 'Y'}); %generating random table
output = myfunction(t); %calling function with table generated;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by