Leaving some tests out of my function?
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
This is my code to read c3dfiles of 5 subjects en their measurements.
function read_data_stair_rise
aantal_proefpersonen = length(dir('data_stair_rise'))-2;
for welke_pp=1:aantal_proefpersonen %first forloop for 5 subjects
myFolder =sprintf('data_stair_rise/pp%c',num2str(welke_pp));
%bepalen van het filepatroon om het later te kunnen inlezen
filePattern = fullfile(myFolder,'*.c3d');
c3dFiles = dir(filePattern);
for i_testen=1:length(c3dFiles); %for their c3dfiles
baseFileName = c3dFiles(i_testen).name;
fullFileName = fullfile(myFolder, baseFileName);
[VideoSignals,VideoSignals_headers,AnalogSignals,AnalogSignals_headers,AnalogFrameRate,VideoFrameRate] = read_c3d_file(fullFileName); %function to read c3dfiles
data_stair_rise(welke_pp, i_testen).VideoSignals = VideoSignals;
data_stair_rise(welke_pp, i_testen).VideoSignals_headers = VideoSignals_headers;
data_stair_rise(welke_pp, i_testen).AnalogSignals = AnalogSignals;
data_stair_rise(welke_pp, i_testen).AnalogSignals_headers = AnalogSignals_headers;
data_stair_rise(welke_pp, i_testen).AnalogFrameRate = AnalogFrameRate;
data_stair_rise(welke_pp, i_testen).VideoFrameRate = VideoFrameRate;
end
end
end
But I don't need some tests. So I created this code:
if ~( ((i_testen == 4) && (welke_pp == 3)) || ((i_testen == 4) && (welke_pp == 4)) );
end
But where should I place this in my function so that these tests aren't included?
Réponses (1)
Geoff Hayes
le 27 Déc 2014
1 vote
Sam - as your conditions depend upon i_testen and welke_pp, then this if statement should be the first line of your inner loop when you know the values for both of these indexing variables.
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!