Multiple outputs from one function?

2 ビュー (過去 30 日間)
Katie
Katie 2012 年 6 月 25 日
Is it possible to obtain 2 outputs for one function? I've written an m file that can give me the 0th, 1st and 2nd moments of some time-resolved spectra, and it appears to be working nicely. However, I want to apply a baseline correction, which I can do within my function, but it would be nice if I could generate a new matrix with the baseline corrected data without having to run two different functions. I want it to pop up in the workspace.
I'm relatively new to programming in general, so any help is really appreciated! I feel like there must be a way to do this, since I can plot it, and I can have it show up in the command window. Thanks!

採用された回答

Nirmal
Nirmal 2012 年 6 月 25 日
A simple example of it is:
function [a,b]= myfunction(c,d)
a=c*d;
b=c+d;
Function returns a,b.
  1 件のコメント
Katie
Katie 2012 年 6 月 26 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by