how to extract table data in structure using multi variables in its path
Show older comments
hello,
I'm using a data-base which is built out of folders and structure in them.
I'm able to get into the right folder but having trouble getting to the table in the structure as they have to be called using few variables.
I want to do the same thing as I do with "V{j}" but it doesn't work.
in the 2 last rows: 1-that work , 2nd- what I want it to be.
thanks!!
function [COP_trail] = COP_extract(P) %Participant # & Subject#_raw have
% to be changed manualy!!
load(['C:\Users\ETAMAR\Desktop\bio-project\files\MATfiles\MAT files\Participant2\Raw_Data.mat'])
COP_trail = cell(8,7);
subjects = {'Subject1_raw','Subject2_raw','Subject3_raw','Subject4_raw','Subject5_raw','Subject6_raw','Subject7_raw','Subject8_raw','Subject9_raw','Subject10_raw','Subject11_raw','Subject12_raw','Subject13_raw','Subject14_raw','Subject15_raw','Subject16_raw'};
V = {'V1','V15','V2','V25','V3','V35','V4'};
for j = 1:7
COP_trail{1,j} = V{j};
for i = 1:7
%comand = sprintf('%s.%s.',(subjects{P}),V{j});
COP_trail{i+1,j} = Subject2_raw.(V{j}).COP{i,2} ;
%COP_trail{i+1,j} = (subjects{P}).(V{j}).COP{i,2} ;
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!