If two vectors of size 1×100 are given, the correlation between corresponding elements is computed as a single correlation coefficient. The 'corrcoef' function returns a 2×2 matrix, where the off-diagonal element is the correlation value between the two vectors. To compute the correlation between all pairs of elements (i.e., a 100×100 matrix), a correlation matrix can be formed by combining the vectors into a 100×2 matrix, and then the correlations between all columns can be computed.
A = rand(1,100);
B = rand(1,100);
% Pairwise correlation matrix (each element: correlation between scalar pairs)
corrMat = (A' - mean(A)) * (B - mean(B)) / ((length(A)-1) * std(A) * std(B));
However, this will produce a matrix where each entry is the product of deviations, not standard correlation.
Kindly refer to the following documentation for detailed information on the 'corrcoef' function: https://www.mathworks.com/help/matlab/ref/corrcoef.html
I hope this helps!