Choosing a specific data from a structure

Hello,
I'm trying to access a structure data by using this code :
File = fullfile(Path, sprintf('%s.mat',Name));
FileData = load(File, Name2);
Alpha = FileData.Name2.Vectors;
Where Path is the path where the structure is stored; Name is the name of the structure and Name2 is the name of one of the .mat file stored in the structure. All works fine util the loading process.
Now i want to choose a specific data stored in Name2.mat which is "Vectors". The problem is that "Name2" is an input of a function so "FileData.Name2.Vectors" won't works in a function. i want to know is there a way to fix this issue?
thank you for your help

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by