MATLAB Answers

assign variable name to Function Output Variables

8 views (last 30 days)
Adrian
Adrian on 8 Nov 2019
Commented: Guillaume on 8 Nov 2019
Hi All
when using a Function it is possible to assign a variable name to the input
e.g
wave = Uph
[.........] = waveform(wave)
Is it possible to use the same variable in the output definition
[wave_rms]=waveform(wave)
so the output variable stored in the workspace is Uph_rms and not wave_rms?
Thanks
Adrian

  0 Comments

Sign in to comment.

Answers (1)

M
M on 8 Nov 2019
Why don't you just change [wave_rms]=waveform(wave) into [Uph_rms]=waveform(wave) ?

  5 Comments

Show 2 older comments
Guillaume
Guillaume on 8 Nov 2019
These 20 waveforms are they 20 different variables? or are they more sensibly stored in a container of some sort (cell array, matrix, table,...)?
Guillaume
Guillaume on 8 Nov 2019
They are 20 different variables
That's where you went wrong and what we have to fix. How were these 20 different variables created in the first place.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!