generate a unique ID

88 visualizaciones (últimos 30 días)
Aziza Zaouga
Aziza Zaouga el 15 de Oct. de 2018
Editada: Andrei Veldman el 19 de En. de 2022
Hello everyone,
I have a function to generate packets (randomly) , and I want to affect to every generated packet a unique ID (an integer for example).
How can I do this in the simplest way ? Because I don't want to complicate more my simulator.
Thanks in advance.

Respuestas (2)

Gareth
Gareth el 20 de Nov. de 2018
This has already been asked:
temp = java.util.UUID.randomUUID;
myuuid = temp.toString;
disp(myuuid)

Andrei Veldman
Andrei Veldman el 19 de En. de 2022
Editada: Andrei Veldman el 19 de En. de 2022
...or, using pure Matlab:
[~,guid] = fileparts(tempname)
guid = 'tp36f88b8b_87c7_4f81_9bb4_81cd95f8a15d'

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by