MATLAB Answers

aet
0

create vector from 21 individual values from for-loop

Asked by aet
on 10 Jun 2019
Latest activity Commented on by aet
on 10 Jun 2019
I have 21 values for K from my for-loop and need to makes these values into a vector. The end goal is to make a box plot. Any guidance?

  2 Comments

Are you indexing the results?

Sign in to comment.

Tags

1 Answer

Answer by Jan
on 10 Jun 2019

K = zeros(1, 21); % Pre-allocation
for ii = 1:21
K(ii) = rand; % Insert your calculations here
end
If you post your code, a more matching answer is possible.

  3 Comments

for i=(1:21)
test=squeeze(A(i,:,:));
V=test(tril(true(size(test))));
K=kurtosis(V)
end
I used this to get 21 values for K. I need to get the 21 Ks into a boxplot ultimately. I figured making it into a vector would be the first step.
K(i) = kurtosis(V);
This worked! Thank you!

Sign in to comment.