How do I pass a cell array from matlab to c code?
Ältere Kommentare anzeigen
Hi every one,
my code snippet in matlab is,
L = zeros(numBlocksN, numBlocksO);
for r = 1:numBlocksN
for c = 1:numBlocksO
[rcEmd] = blockDistance(cell1{r}, cell2{c});
L(r,c) = rcEmd;
end
end
where numBlocksN & numBlocksO are constants, and cell1 & cell2 are cell arrays and the element of each (i.e., cell1{r} & cell2{c}) are structure arrays. The blockDistance inside loop is a self-defined fuction which computes the distance between cell1{r} and cell2{c}.
As is known, it is time-consuming to use loops in Matlab. So I want to translate this particular snippet into c source. I need to pass the integers numBlocksN, numBlocksO and two cell arrays ( cell1 and cell2 ) into c as arguments. And also, I want return the computed result L which carries the distance between each cell1{r} and cell2{c}. Could anyone kindly point out me a way to achieve this? Many thanks in advance.
Akzeptierte Antwort
Weitere Antworten (1)
YIMING
am 27 Feb. 2011
0 Stimmen
Kategorien
Mehr zu MATLAB Compiler finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!