How to make function assign variables that will stick around after the function is done running?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Solarmew
il 20 Mag 2015
Commentato: Star Strider
il 20 Mag 2015
For example:
function test(x)
car.color = x;
end
if i first input
global car
I want car.color to exist after i input test('red')
0 Commenti
Risposta accettata
Star Strider
il 20 Mag 2015
Have it return the structure ‘car’ as an output:
function car = test(x)
car.color = x;
end
%
car = test('red')
produces:
car =
color: 'red'
8 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!