필터 지우기
필터 지우기

How to pass an array in Matlab Production Server

조회 수: 2 (최근 30일)
Ismael Raqi Picardo
Ismael Raqi Picardo 2023년 4월 15일
댓글: Kojiro Saito 2023년 4월 19일
Im using Production Server Compiler to build an endpoint where a Java client can make petitions to, but when I'm trying to pass the parameters to my function, It only accepts simple numbers or strings, like [1, 30.2, 200, "example"] and I need to pass a 3D array (if it works for a 2D array I can make it work).
{ "nargout":1, "rhs": [10] } This works, because It pass the number 10 to my function parameter, but if I need an array of 5 numbers, for example, this doesn't work
{ "nargout":2, "rhs": [10, 20, 30, 40, 50] }
My test function:
function out = sumar(array)
array(1, :)
out = array;
end
Thanks!

채택된 답변

Kojiro Saito
Kojiro Saito 2023년 4월 19일
You need to include "[" and "]" for passing arrays to MATLAB Production Server.
{"nargout":1, "rhs": [[10, 20, 30, 40, 50]]}
  댓글 수: 2
Ismael Raqi Picardo
Ismael Raqi Picardo 2023년 4월 19일
I have just been contacted by Matlab support, they told me to put it in this format because we need to specify that we are dealing with an array (with the parameters 'mwsize' and 'mwtype'), so it has to be passed in 1D linear array format.
{
"nargout": 1,
"rhs": {
"mwdata":[1,3,5,2,4,6,7,9,11,8,10,12,13,14,15,16,17,18],
"mwsize":[3,2,3],
"mwtype":"double"
}
}
Regardless of this, I thank you very much for the reply!
Kojiro Saito
Kojiro Saito 2023년 4월 19일
Thank you for your comment. Sure, above is JSON large notation wtih mwsize described in this document.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Enterprise Deployment with MATLAB Production Server에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by