Matrix dimensions must agree problem
Afficher commentaires plus anciens
I have an cell array (7879*1) and the first 6 six terms are:
LV.cc-LV.vr.cr
CL.ptp-LV.cr.ca
LP.li-CL.ptp
LV.cc-LV.vr.cr
CL.ptp-LV.cr.ca
LP.li.ca-RG.le.ca
SC.gl
CM.vr-RG.ca
I want to write a code that if cell is equal to LV.cc-LV.vr.cr then B is equal to A, and if cell is equal to SC.gl then B is equal to E. I write this code but it gives me error "Matrix dimensions must agree problem". My code is:
for i=1:numel(cell);
if cell{i}=='LV.cc-LV.vr.cr';
B{i}='A';
else if cell{i}=='CL.ptp-LV.cr.ca';
B{i}='B';
else if cell{i}=='LP.li-CL.ptp';
B{i}='C';
else if cell{i}=='LP.li.ca-RG.le.ca';
B{i}='D';
else if cell{i}=='SC.gl';
B{i}='E';
else cell{i}=='CM.vr-RG.ca';
B{i}='F';
How can I solve Matrix dimensions must agree problem ? Thank you.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrices and Arrays 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!