Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
acessing structure data from an embedded matlab function using s-function
조회 수: 1 (최근 30일)
이전 댓글 표시
i am transmitting a structure data which has around 500 elements(but it varies so i also need to find out the number of input fields of the structure) all of which are of different data types (uint8,unit16,uint32,single). first to transmit this structure i created a bus object and then transmitted them using the embedded matlab function. now i need to separate the individual signals (like flattening the structure) in the output. i can use a bus selector and do this but instead i want to use an s-function. so i used an s-function builder (and not the normal s-function block) block and tried to access the first two signals using
y0[0]=u0->speed; y1[0]=u0->yaw_rate;
but i want to use a loop to actually allocate the individual inputs to separate outputs. For this i need to know the number of inputs, its datatype and its fieldname.Is it possible?
I was going through the documentation and came accross stuff like mxGetFieldNameByNumber and mxGetNumberOfFields but i just don't know how to use these inside a s-function builder. Or if its possible to write a normal mex code using normal s-function block then how to add the bus-elements to this s-function C file.
Or Am i approaching the whole problem completely wrong? is there a way to transmit a structure or a cell array other than using this method and without creating a bus element?
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!