필터 지우기
필터 지우기

Randomizing samples without losing track on labels

조회 수: 1 (최근 30일)
Vivek Raj
Vivek Raj 2023년 9월 13일
댓글: Akshat Dalal 2023년 9월 16일
I have 5 different images data and I want to shuffle/randomize each time when displayed. I want to keep track on which image I am showing. How I can do it in matlab? For example I have images of cat, dog, cows, lions and tigers. I want to show them to users for 5 trials. How I can keep a track on their labels. Is there any data structure like keys and values in python which can be implemented in Matlab?

채택된 답변

Akshat Dalal
Akshat Dalal 2023년 9월 13일
Hi Vivek,
The dictionary object will be helpful for your problem - https://in.mathworks.com/help/matlab/ref/dictionary.html
  댓글 수: 2
Vivek Raj
Vivek Raj 2023년 9월 16일
Can you share one of the working code to facilitate understanding
Akshat Dalal
Akshat Dalal 2023년 9월 16일
Hi Vivek,
There are many examples provided in the link. I'll attach one of them here, but you could always go back to explore more.
wheels = [1 2 3];
names = ["Monocycle" "Bicycle" "Tricycle"];
d = dictionary(names,wheels)
d = dictionary (string --> double) with 3 entries: "Monocycle" --> 1 "Bicycle" --> 2 "Tricycle" --> 3
d("Tricycle")
ans = 3
d("Bicycle") = 2.5
d = dictionary (string --> double) with 3 entries: "Monocycle" --> 1 "Bicycle" --> 2.5000 "Tricycle" --> 3
d("Car") = 4
d = dictionary (string --> double) with 4 entries: "Monocycle" --> 1 "Bicycle" --> 2.5000 "Tricycle" --> 3 "Car" --> 4
names2 = ["Truck" "Motorcycle" "Sixteen-Wheeler"];
wheels2 = [4 2 16];
d(names2) = wheels2
d = dictionary (string --> double) with 7 entries: "Monocycle" --> 1 "Bicycle" --> 2.5000 "Tricycle" --> 3 "Car" --> 4 "Truck" --> 4 "Motorcycle" --> 2 "Sixteen-Wheeler" --> 16
d("Truck") = [] % Remove entries by assigning an empty array to an existing key.
d = dictionary (string --> double) with 6 entries: "Monocycle" --> 1 "Bicycle" --> 2.5000 "Tricycle" --> 3 "Car" --> 4 "Motorcycle" --> 2 "Sixteen-Wheeler" --> 16

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by