How to assign value to a variable?

3 visualizaciones (últimos 30 días)
Iugo
Iugo el 26 de Mzo. de 2021
Comentada: Jan el 28 de Mzo. de 2021
Hello everyone!
I have a code that allows user to choose the folder of subjects from different groups of data (17 in total, where one contains all the subjects from all groups) to perform a certain analysis. I already used dir function to store all the information from the folder with all the subjects from all groups (name, folder, date, etc) in a variable PasteInfo, as well as a field with the classification labels that define if that subject is diseased ou healthy, as show below.
At some point of my code, I need to extract that classification labels for all the subjects of the selected folder (from one specific group or from the paste with all of them) and save in a .mat file. Plus, how can I accomplish it even if the subjects were randomly selected? For example, the user selects folder "Caltech" and gets the .mat file with those classification labels, or if he selects random subjects from the folder with all of the subjects and gets that .mat file with those classification labels...
Can someone give me a help?
Thank you so much!
  2 comentarios
Matt J
Matt J el 27 de Mzo. de 2021
Editada: Matt J el 27 de Mzo. de 2021
You're using the word "paste" in a way I don't recognize. Is that data science jargon of some kind?
Iugo
Iugo el 27 de Mzo. de 2021
Oh sorry @Matt J, with paste I mean folder... so sorry about that

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 27 de Mzo. de 2021
How do you want to select the subjects randomly? How does the users select a folder?
The current explantions are too vague for a reliable suggestion of code. But a bold guess:
FolderList = {PasteInfo.folder};
[~, FolderName] = fileparts(FolderList);
MatchFolder = strcmp(FolderList, 'Caltech');
Labels = {PasteInfo(MatchFolder).Labels};
And now?
  2 comentarios
Iugo
Iugo el 27 de Mzo. de 2021
Editada: Iugo el 27 de Mzo. de 2021
I will reformulate @Jan.
I have a struct variable called PasteInfo, that contains information such as name, folder, date, etc, about the subjects from the folder selected by the user. I also have a struct variable called PasteInfoLabels which has the same information (image below), plus the classification labels (0's and 1's), but for all the data from all the group folders.
My goal is to, no matter what folder is selected by the user, the code being able to retrieve a column vector .mat file with the respective classification labels of that folder subjects...
Do you have any ideas of how can I accomplish this?
Thank you so much for your help!
Jan
Jan el 28 de Mzo. de 2021
Sorry, I cannot follow you. I still do not know, how a user can select a folder. What are the "classification labels" of "that folders subject"? What is a subject? What are group folders?
What is the difference between the output of my suggested code and your need?

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by