Loop through every nth row in a data frame in a function
Show older comments
I want to loop through specific rows to pick up data for some program I wrote and wondering if there is an efficient way of doing that. I have my coordinates in a matrix and each row represents a subject and the colums are the different orientation coordinates for a subject (see below)

In my loop I want to go through each row (each row and pick e.g "nose" for for each subject)
%% Define coil position
S.poslist{1}.pos(1).matsimnibs = [-m0n0 m1n0 -m2n0 x; -m0n1 m1n1 -m2n1 y; -m0n2 m1n2 -m2n2 z; 0 0 0 1]
I want to achieve something like this below but selecting every 4th row
S.poslist{1}.pos(1).matsimnibs = [-TargetInfo.data(4) TargetInfo.data(7) -TargetInfo.data(10) TargetInfo.data(1); -TargetInfo.data(5) TargetInfo.data(8) -TargetInfo.data(11) TargetInfo.data(2); -TargetInfo.data(6) TargetInfo.data(9) -TargetInfo.data(12) TargetInfo.data(3); 0 0 0 1]
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!