How can i convert a code c++ to matlab code
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I woud like to convert a code written on C++ to a matlab code .there isn't any help ???
this is a a section of my code :
struct noeud{ float cout_g, cout_h, cout_f;
std::pair<int,int> parent;
};
struct point{ int x,y; };
typedef map< pair<int,int>, noeud> l_noeud;
SDL_Surface *s = SDL_LoadBMP("carte.bmp");
SDL_SaveBMP(s, "resultat.bmp");
/* calcule la distance entre les points (x1,y1) et (x2,y2) */
float distance(int x1, int y1, int x2, int y2){
/* distance euclidienne */
return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
/* carré de la distance euclidienne */ /*
return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2); */}
2 comentarios
Darshan Ramakant Bhat
el 8 de Feb. de 2021
If you want to call the C++ code from MATLAB, please refer below documentations :
Respuestas (1)
Walter Roberson
el 8 de Feb. de 2021
s = imread("carte.bmp");
imwrite(s, "resultat.bmp");
function z = distance(x1, y1, x2, y2)
z = hypot(x1-x2, y1-y2)
end
Do you need classdef definitions to construct the same classes?
1 comentario
Mouna SAMAALI
el 8 de Feb. de 2021
Editada: Walter Roberson
el 8 de Feb. de 2021
Ver también
Categorías
Más información sobre MATLAB Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!