Mex function, one or more output arguments not assigned
Afficher commentaires plus anciens
Hello,
I get the following error when trying to test my mex function "One or more output arguments not assigned during call to 'mymexfunction'". There should be 102 outputs from the function.
I do the following to copy the variables from the fortran code back to matlab
plhs(1) = mxcreatedoublematrix(m2,n2,0)
plhs(2) = mxcreatedoublematrix(m2,n2,0)
plhs(3) = mxcreatedoublematrix(m2,n2,0)
etc...
MRb1_1p_pr = mxgetpr(plhs(1))
MRb1_2p_pr = mxgetpr(plhs(2))
MRb1_3p_pr = mxgetpr(plhs(3))
etc...
call mxcopyreal8toptr(MarkersResults%Blade(1,1)%Position,MRb1_1p_pr,size2)
call mxcopyreal8toptr(MarkersResults%Blade(2,1)%Position,MRb1_2p_pr,size2)
call mxcopyreal8toptr(MarkersResults%Blade(3,1)%Position,MRb1_3p_pr,size2)
etc...
I try to get the results using the following syntax in my .m file
%[M1, M2, M3, etc..] = mymexfunction(var1, var2)
Réponses (1)
James Tursa
le 23 Juil 2012
2 votes
102 outputs is a LOT, and seems to me would be hard to maintain. Returning a single cell array would probably be a better approach.
That being said, I am not sure what the internal limit is for this. I know mexCallMATLAB has an internal limit of 50. There may be a similar limit for the plhs array. But assuming this is not an issue, do you really have 102 statements creating outpus from plhs(1) all the way through plhs(102)? Are these all behind some type of "if" check to make sure nlhs == 102? Are you sure you have 102 outputs in your m-file calling sequence?
5 commentaires
Chris
le 23 Juil 2012
James Tursa
le 23 Juil 2012
If you post the declarations for AD_Init etc I can reply with code that will return a single cell or struct array back to MATLAB.
Chris
le 24 Juil 2012
Chris
le 24 Juil 2012
Chris
le 6 Août 2012
Catégories
En savoir plus sur Fortran with MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!