Mex function, one or more output arguments not assigned
조회 수: 2 (최근 30일)
이전 댓글 표시
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)
댓글 수: 0
답변 (1개)
James Tursa
2012년 7월 23일
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?
참고 항목
카테고리
Help Center 및 File Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!