How to generate C code for mvnrnd using matlab coder ?

3 visualizzazioni (ultimi 30 giorni)
ZYGN
ZYGN il 19 Nov 2013
Commentato: Ketan il 23 Nov 2013
Hello,
I am trying to generate C code using coder for a function that uses mvnrnd function. I receive this error message about this lines
if m1 == c mu = mu'; end
Size mismatch (size [154 x 1] ~= size [1 x 154]). The size to the left is the size of the left-hand side of the assignment.
and this error about this line :
X(t,:) = mvnrnd(mu,sigma,cases);
The left-hand side has been constrained to be non-complex, but the right-hand side is complex. To correct this problem, make the right-hand side real using the function REAL, or change the initial assignment to the left-hand side variable to be a complex value using the COMPLEX function.
Thank you for your help
  1 Commento
Ketan
Ketan il 23 Nov 2013
It looks like based on a previous usages of the variable "mu", MATLAB Coder has associated a size of [154 x 1] with mu. Therefore it is erroring when trying to assign mu' to mu because mu' does not have size [154 x 1], it has size [1 x 154].
If you want mu to have the ability to take on different sizes IE [1 x 154] or [154 x 1] you can tell MATLAB coder to implement "mu" as variable size. Here are some doc pages on defining variable size data :

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by