필터 지우기
필터 지우기

Mex function, one or more output arguments not assigned

조회 수: 2 (최근 30일)
Chris
Chris 2012년 7월 23일
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)

답변 (1개)

James Tursa
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?
  댓글 수: 5
Chris
Chris 2012년 7월 24일
Also is there a limit to the number of inputs you can have? If I have a nested struct for an input for a total of over a 100 inputs would that be a problem?
Chris
Chris 2012년 8월 6일
Hi James,
Were you able to write a code that returns a struct array? I'm still stuck on this part of the project.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by