Effacer les filtres
Effacer les filtres

Please help me, i dont understand how to make matlab code are acceptable on matlab coder

1 vue (au cours des 30 derniers jours)
In previously, i have code s2(i) = o_img(a,b); and that code is unacceptable in matlab coder, so i change become s2 = [s2;o_img(a,b)]; After changed, the code was accepted in matlab coder.
But, i still have some errors in line ' min_path_index(minu_count, :) = [sx sy]; '
The error from that code is same with error code s2(i) = o_img(a,b);

Réponses (1)

Walter Roberson
Walter Roberson le 20 Mai 2018
Do not grow arrays in MATLAB coder. Instead, initialize them to the maximum size you will ever allow. Assign values into the array, keeping track of how many you have assigned. At the end, assign the variable the portion of the variable that was actually used. In this way, the array never grows in size, only (possibly) shrinks in size at the end.
See also coder.varsize()
  2 commentaires
Dicki Andrea
Dicki Andrea le 21 Mai 2018
Thanks you Robert for your question. I already follow your suggestion. I declare variable min_path_index = zeros(200,2). And the error is gone.
Is that right?

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by