generate a unique ID

조회 수: 109 (최근 30일)
Aziza Zaouga
Aziza Zaouga 2018년 10월 15일
편집: Andrei Veldman 2022년 1월 19일
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.

답변 (2개)

GT
GT 2018년 11월 20일
This has already been asked:
temp = java.util.UUID.randomUUID;
myuuid = temp.toString;
disp(myuuid)

Andrei Veldman
Andrei Veldman 2022년 1월 19일
편집: Andrei Veldman 2022년 1월 19일
...or, using pure Matlab:
[~,guid] = fileparts(tempname)
guid = 'tp36f88b8b_87c7_4f81_9bb4_81cd95f8a15d'

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by