storing and appending in a for loop
Afficher commentaires plus anciens
Hi !
I want to store and append tables data in a for loop. below is the part of code.
using the k as a counter, it stores start and fin values in a vector. but I don't know how to store rng values and tables (and append tables in each loop)
When I am using rng(k) = .... I get this error :
"Unable to perform assignment because the size of the left side is 1-by-1316 and the size of the right side is 1-by-1253 "
and when I use rng and T (as below), it overwrites the data within each loop.
Can someone please help?
% vec,Rep,Pos = some data
k = 1
for i = 1:length(vec)
time = (data(vec(i+1)));
if time >= 6
start(k) = vec(i);
fin(k) = vec(i)+1;
%Question part
rng = start(k):fin(k);
T = table(data.Rep(rng),data.Pos(rng))
k = k+1;
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!