access struct data using 'fileName' given by U = load([filePath fileName])
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
thanks in advance.
I load a mat file called, for example, bending0001.mat using:
%------------------
[fileName filePath] = uigetfile('*.mat', 'Select data file', '.');
if filePath==0, error('None selected!'); end
U = load([filePath fileName])
%------------------
I want to access the struct data without giving the file name, but using the U. That means:
- this way :)
length_ = length(U.Trajectories.Labeled.Data(6,:,:));
- not this way :(
length_ = length(bending0001.Trajectories.Labeled.Data(6,:,:));
what happens is that the higher struct field has the same name as the file, using this feature, I could open multiple files easier without typing the name at each access
thank you a lot,
Carolina
2 comentarios
TAB
el 29 de Mzo. de 2012
Variables from the U=load('bending0001.mat') function will be collected in U and not in bending0001.
Please check your question. It is not clear.
Respuestas (1)
Ver también
Categorías
Más información sobre Structures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!