How can I assign values to my whole cell array? I am getting [], but am unsure as to why.
    4 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Sean Goulding
 le 24 Fév 2022
  
    
    
    
    
    Commenté : Sean Goulding
 le 24 Fév 2022
            I want my code to assign epochs (in 'a' datapoint intervals) into a cell array. In this case 'a' is 200. Total recording length is 587 epochs. 'k' is my patient number. Therefore, in this use case I should have a cell array with 46x587 cells, where each cell contains a 21x200 double. My code can be seen below:
for k = 1:46
    for i = 1:b
        NC_x{k, i} = NC_patient{k}(:,a*(i-1)+1:a);
    end
end
Unfortunately, only the first column of my cell array is assigned the 21x200 doubles. Why is this, and how can I resolve it?
I look forward to receiving a response.
Kindest regards,
Sean
2 commentaires
  the cyclist
      
      
 le 24 Fév 2022
				It's a bit difficult to know what the problem is. You don't mention what the value of b is. Could it be 1, and therefore you are only operating on the first column, in the loop over i?
Can you upload the data in a MAT file, so we can run your code?
Réponse acceptée
  Walter Roberson
      
      
 le 24 Fév 2022
        for k = 1:46
  for i = 1:b
      NC_x{k, i} = NC_patient{k}(:,a*(i-1)+1:a*i);
  end
end
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Matrix Indexing dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!