avoid variables being overwritten
Mostrar comentarios más antiguos
i have an array (416x3) and i want to partition it out in a particular pattern. i want break it up into 104 trial chunks and i want to break that chunk into 5 chunks. for example, i want the first 16 rows, then the next 24 rows three times each, then the last 16 rows. i also want to make a variable for each one (r for 16 rows, s for 24), so the first chunk is r1, second is s1, s2, s3, and the last 16 rows would be r2. i just cant seem to wrap my head around saving the variables so they arent overwritten. any suggestions?
data=xlsread('subject10_session3.csv');
BPR=16;
BPS=24;
for i =1:LB
R{i}=data(1:BPR,:);
data=removerows(data,'ind',[1:BPR]);
S{i}=data(1:BPS,:);
data=removerows(data,'ind',[1:BPS]);
S{i+1}=data(1:BPS,:);
data=removerows(data,'ind',[1:BPS]);
S{i+2}=data(1:BPS,:);
data=removerows(data,'ind',[1:BPS]);
R{i+1}=data(1:BPR,:);
data=removerows(data,'ind',[1:BPR]);
end
1 comentario
dpb
el 21 de Jul. de 2013
I can't parse the actual want...can you give a very short sample? Specifically I can't see how you can take 416 into 104 "chunks" that aren't four lines each and then how that can be evenly divisible by 5.
I can get a split into five subsections as you list but don't really see how you want to put it together in the end.
I'd also question the idea of wanting new named variables but either use cell arrays or structure fields of just indexing to hold the subsets--usually dynamically trying to name stuff just leads to more complications than it solves.
Respuestas (0)
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!