MATLAB: 2 outputs from a function (pwelch) into a cell array

cell arrayscellfunpwelchwindow(s) length

I am using the function pwelch to calculate the PSD of my signal. Currently, I am doing
[pxx,f] = pwelch(data,50000,[],[],Fs);
for a single window value. However, I need to test several window values so I created
pwelchvalues= [10000 50000 100000 250000 500000 750000];
But now I don't know how to modify the left side of the equation. I cannot use just
[pxx,f] =
because the pxx's and f's of each value will be of different length. I have tried for loops, cellfun and several combinations like
[pxx{:},f{:}] = pwelch(data, pwelchvalues,[],[],Fs);
but I keep getting error like: "Cell contents assignment to a non-cell array object." or "Error: Unbalanced or unexpected parenthesis or bracket."
What is the correct syntax?

Best Answer

[pxx, f] = arrayfun(@(W) pwelch(data, W, [], [], 2048), pwelchvalues, 'uniform', 0);