Azzera filtri
Azzera filtri

Arrays as input signals for CMEX function

1 visualizzazione (ultimi 30 giorni)
Rob il 11 Ago 2014
Modificato: Rob il 11 Ago 2014
Hi, I really searched Google, the MATLAB Online Docs and the MATLAB Answers for this, but didn't get any result.
I need to accept a dynamically sized array as input signal for my CMEX SFunction. I copied the example from the ssGetInputPortSignal online description and it just threw an error because of this line:
When I compile, it says:
error C2100: illegal indirection
It gets the width correctly, but fails in accessing the array.. Even if I force the indirection by casting to a double pointer or stuff, MATLAB crashes because of an access violation (of course...). I did not find one single example on how to access elements of an array. Please, please, provide one. It can't be that hard :-P
Thank you very much!!
I changed the code and inserted output and it turns out that every 2n-1 element in the array has the value 0:
const real_T **u1 = (const real_T**) ssGetInputPortSignal(S,1);
for (int i=0;i<(int)ssGetInputPortWidth(S, 1);i++) {
std::cout << u1[i] << "," << std::flush;
std::cout << ")" << std::endl;
u1 width: 10
u1 elements: (00000000,3FF00000,00000000,40000000,00000000,40080000,00000000,40100000,00000000,40140000,)
std::cout << *u1[i]
still gives me the compiler error C2100 or (if I do some tricks to get rid of the compiler error) causes MATLAB to crash...

Risposte (0)


Community Treasure Hunt

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

Start Hunting!

Translated by