Passing one value at a time

2 views (last 30 days)
Sugar Mummy
Sugar Mummy on 30 Dec 2021
Commented: Sugar Mummy on 4 Jan 2022
Hi,
I need to pass one value at a time from matrix. For example, first value would be 0.0087 the loop execute and display that, then 0.0074 and so on...
Any help is appreciated. Thanks in advance.

Answers (1)

KSSV
KSSV on 30 Dec 2021
A = rand(5,1)
A = 5×1
0.0300 0.1842 0.7141 0.0645 0.4457
for i = 1:length(A)
A(i)
end
ans = 0.0300
ans = 0.1842
ans = 0.7141
ans = 0.0645
ans = 0.4457
  14 Comments
Walter Roberson
Walter Roberson on 3 Jan 2022
Store the names of the variables in an array, and use a loop to call find(simOut, NAME) for each of the variables.
Sugar Mummy
Sugar Mummy on 4 Jan 2022
Thank you for the help!

Sign in to comment.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!