Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Leaving some tests out of my function?

1 Ansicht (letzte 30 Tage)
Sam
Sam am 27 Dez. 2014
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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?

Antworten (1)

Geoff Hayes
Geoff Hayes am 27 Dez. 2014
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.

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by