Q:

how to randomly multiply symbolic array with matrix

Assuming a matrix W of dimensions n-by-n which is known, and its elements are positive numbers between 0 and 1.
Assuming also a symbolic vector 
k = [a b c d];

I need to randomly multiply each all the non-zero component of W with one at a time of the components of k(randomly), such as e.g.:

What I tried:
k = sym('a', [1 4]);
msize = numel(k);
k(randperm(msize, 1))

for i = 1:length(W)
    for j = 1:length(W)
        W(i,j) = W(i,j)*(k);
    end
end

and the error was the following:
The following error occurred converting from sym to double:
Error using maplemex
Error, (in MTM:-double) cannot handle unevaluated name `a1` in evalhf

A:

First we define the inputs:
% PARAMETERS

% k: symbolic vector of length m
m = 4;
k = sym('a', [1, m]);

% W: n-by-n matrix of doubles
n = 5;
W = rand(n);

Here is the calculation:
% CALCULATION

% random assignment of elements of k to the shape of W
I = randi(m, n);
K = k(I);

% result: element-wise multiplication of K and W
result = K .* W;

