It may be useful for future seekers to use the new Probability Distribution Objects in MATLAB. This highlights utility of makedist(), random(), and pdf() functions (though others work too). See documentation.
You can define the probability distribution object first (shown below with output).
>> pd = makedist('Weibull',12.34,1.56)
pd =
WeibullDistribution
Weibull distribution
A = 12.34
B = 1.56
Then obtaining the theoretical mean(), median(), std(), or var() is easy.
>> mean(pd)
ans =
11.0911
>> var(pd)
ans =
52.7623
>> median(pd)
ans =
9.7562
Then generating random variates is simple with the random() command.
n = 2500;
X = random(pd,n,1);

Note: Probability Distribution Objects introduced in R2013a.
figure, hold on, box on
histogram(X,'Normalization','pdf','DisplayName','Empirical (n = 2500)')
plot([0:.01:50],pdf(pd,[0:.01:50]),'b-','LineWidth',2.5,'DisplayName','Theoretical')
Reference: Weibull distribution