In Matlab Coder: How can I work with cat function in a loop

4 vues (au cours des 30 derniers jours)
Avi
Avi le 20 Oct 2013
Hello,
I have a problem in Matlab Coder.
  • * Here is the test file * * :A_in = magic(3);A_out = My_Func (A_in);
  • * And here is the funcion :* *function A_out = My_Func (A_in) [r, c] = size (A_in); a = double(repmat (A_in(1,:), 1, 1)); b = double(repmat (A_in(r,:), 1, 1)); Atemp = [a; double(A_in); b]; d = repmat(Atemp(:,1), 1, 1); e = repmat(Atemp(:,end), 1, 1); Atemp1 = [d Atemp e]; Atemp_all= []; for I = 1:3 for J = 1:3 f = Atemp1(I:I+r-1,J:J+c-1); Atemp_all= double (cat (3, Atemp_all, f)); end; end; A_out = median (Atemp_all,3);end
Running it in Matlab is OK. But trying to build My_Func_mex causes the next error:
Dimension 1 is fixed on the left-hand side but varies on the right ([0 x 0] ~= [:? x :? x :?])
Can you help me please? Thanks

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by