Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Leaving some tests out of my function?

조회 수: 1 (최근 30일)
Sam
Sam 2014년 12월 27일
마감: MATLAB Answer Bot 2021년 8월 20일
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?

답변 (1개)

Geoff Hayes
Geoff Hayes 2014년 12월 27일
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.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by