matlab coder generation mex verification failed?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
cui,xingxing
el 19 de Mzo. de 2022
Respondida: Matan Silver
el 14 de Abr. de 2022
When I use matlab coder app to generate C code from my matlab code, I first start to verify if mex is runnable, but this step directly reported an error failure, according to the prompt I do not know how to modify, I am sure edgeIJ(:,1) is a single non-empty column vector of length at least 2, the matlab code runs without problems, please ask how to modify Thanks!
See attachment for additional code
0 comentarios
Respuesta aceptada
Matan Silver
el 14 de Abr. de 2022
Hello,
I believe we can see the problem if we run myFun normally in MATLAB and set a breakpoint on line 88. We will see that the output of the call to mink is:
K>> [aa,bb]=mink(edgeIJ(:,1),2)
aa =
171
173
bb =
3
1
however, idxs, which is receiving the second output of mink, is 1x2, not 2x1:
K>> idxs
idxs =
3 4
So in this case, MATLAB Coder is complaining about assigning a 2x1 value into a 1x2 variable. You could perhaps fix this by storing the second output in an intermediate variable, and assigning it to idxs after transposing:
[minRows,idxs_untransposed] = mink(edgeIJ(:,1),2);
idxs=idxs_untransposed';
When I run "check for issues" on your example after making this change, "check for issues" passes. However, I'm not sure if this is actually what you want to do in your algorithm, so please check to make sure it is doing the right thing.
Matan
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!