The return value of the extrinsic function is a variable array, How can I access it?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bin Liao
le 14 Juil 2016
Réponse apportée : Denis Gurchenkov
le 14 Juil 2016
J = zeros(0,1);
coder.varsize(J);
coder.extrinsic('fast_union_sorted');
temp = fast_union_sorted(activeSet, I);
J = temp;
the size of the array temp is not fixed size;
Matlab will report error when executing " J = temp", such as
expression 'temp' is not of the correct size: expected [0x1] found [5x1].
How can I solve it?
Thanks!
1 commentaire
Réponse acceptée
Denis Gurchenkov
le 14 Juil 2016
After the call to fast_union_sorted(), read the size of the return value, and reallocate J to be of that size:
coder.varsize('J');
coder.extrinsic('fast_union_sorted');
temp = fast_union_sorted();
n = [0 0];
n = size(temp);
J = zeros(n);
J = temp;
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Coder dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!