How to retrieve iSubject?

Hi everyone,

I am trying to retrieve the univocal index associated with the subjects, but it seems impossible to get that info. I tried using bst_get and investigating variables such as ProtocolInfo or ProtocolSubjects, but that information is not there. Any clue?

Many thanks,
Ramtin

Metadata for all Subjects:

% Get all subjects:
ProtocolSubjects = bst_get('ProtocolSubjects');

ProtocolSubjects.DefaultSubject : Subject with Default anatomy
ProtocolSubjects.Subject: Array of all other Subjects, their index is the index in this array.

Metadata for one Subject

iSubject = 1;
sSubject = bst_get('Subject', iSubject);

This is equal to ProtocolSubjects.Subject(iSubject)

Get index for Subject with a given SubjectName

[sSubject, iSubject] = bst_get('Subject', 'SubjectName');

Check this link:

1 Like

I was not sure about this, thank you for confirming.

This is exactly what I needed, thank you!

Ramtin