Info

此问题已关闭。 请重新打开它进行编辑或回答。

Leaving some tests out of my function?

2 次查看(过去 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