Concatenate Results from Function
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jonathan Pinko
am 16 Jun. 2020
Kommentiert: David Hill
am 17 Jun. 2020
I have the following script:
Apples=1:1:5;
Bananas=10:1:15;
for a=1:numel(apples)
for b=1:numel(bananas)
[lions,tigers,bears]=woof(apples(a),bananas(b));
end
end
In which woof is a function that I am calling.
When I run this function, only the final results of lions, tigers, and bears are stored in my workspace. Instead, I would like to vertically concatenate all of my results of lions, tigers and bears, from all of my values of apples and bananas. In doing so, I would have 3 separate vectors, one each for lions, tigers, and bears, stored in my workspace.
How would I do this?
Thanks,
Jonathan
0 Kommentare
Akzeptierte Antwort
David Hill
am 17 Jun. 2020
apples=1:1:5;
bananas=10:1:15;
c=1;
for a=1:numel(apples)
for b=1:numel(bananas)
[lions(c),tigers(c),bears(c)]=woof(apples(a),bananas(b));
c=c+1;
end
end
6 Kommentare
David Hill
am 17 Jun. 2020
If you are satisfied with the answer, you should accept it to close out the question.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!