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