238 258 bytes
I'm assuming based on the limitations of the other answers that the number order of the input array is maintained by fiat.
p=[p char(' '*~~p(:,1))]'
This code takes a string of numbers
x = '12345' and a result
r = 15 and returns all of the strings of expressions you can evaluate to get
x using the four operators.
I've used two different length-equivalent ways of avoiding using
~~p(1,:) which returns not-not values in
p (i.e., a list of
1s the samelength as the first dimension of
0|p(:,1) which returns 0 or is-there-a-value-in-
p (i.e., a list of
1s the same length as the second dimension of
Matlab doesn't have an
nchoosek with replacement method, so I've duplicated the operators the correct number of times, computed the whole space of
nchoosek for that larger selection of operators, and then used a
unique call to pare the result down to what it should be (removing equivalent combinations like '***+' and '***+'). I add a trailing space to match the length of the input vector for concatenation purposes and then compose the operator strings with the input strings into the columns of a matrix. I then evaluate the expressions columnwise to get results and find the order of operators that corresponds to those columns with results that match our input
x = '12345',
r = 15:
If I had to take an array of double precision values, I'd need
x = num2str(x,'%d'); in order to convert the digits to a string, adding 21 (20 without the
;) to my score. *The extra bytes were semicolons I left in purely so that anyone running this code won't see their command prompt blow up with long arrays. Since my edit produces a giant pile of warnings about logicals and colon-operands now anyway, I've removed the semicolons in the new version.
Edit 2: Forgot to replace a
p=[p repmat(' ',l,1)]';
o = p(:,r == cellfun(@eval, mat2cell(c,n*2+2,ones(l,1))));