generate a unique ID

110 ビュー (過去 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 Center および File ExchangeFunction Creation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by