0

Say I have 3 matrix data files in a folder..

I have a function (clustering_coef_bu) which calculates the clustering coefficient of a 2D matrix (data; has the dimensions 512x512) file. The output vector of the function creates a 512x1 Matrix (Clustering Coefficient), in double format.

With the for loop below, for each matrix (data) I'm calculating the clustering coefficient. However, I am having difficulties being able to store the output clustering coefficient for each run of the for loop. It would be ideal to output the clustering coefficient of each matrix into one singular structure. I.e a cell array, which has the dimensions 512x3.

for k = 1:3  
     ClusteringCoefficient=clustering_coef_bu(data)
end 

Any help would be great. Thanks.

1 Answer 1

2

Something like this would probably help you:

widthArray = 3;
ClustingeringCoefficient = zeros(size(data, 1), widthArray);

for k = 1:widthArray
    ClusteringCoefficient(:, k) = clustering_coef_bu(data); % a 512x3 double matrix
end 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.