Getting an error when trying to create a 92x1 matrix.
Afficher commentaires plus anciens
[242.8;241.4;243.8;243.0;243.6;...
240.0;243.6;242.8;242.2;242.0;...
243.4;242.8;243.4;242.6;239.2;...
240.8;240.6;241.0;239.8;239.2;...
241.2;242.0;238.6;237.2;237.4;...
238.8;239.0;241.8;241.8;239.6,...
239.0;239.8;239.2;241.8;239.2;...
239.2;238.4;238.6;240.0;239.6;...
240.8;241.2;237.8;237.6;236.6;...
238.6;238.0;239.2;238.0;238.4;...
237.4;237.0;238.4;238.4;237.2;...
236.8;237.4;236.8;237.8;238.8;...
235.8;235.2;236.8;238.0;240.4;...
241.4;236.6;235.2;235.2;236.6;...
233.0;235.6;235.2;232.6;232.2;...
233.2;234.6;234.6;235.8;237.2;...
235.0;235.0;237.0;238.6;234.6;...
234.8;235.4;235.2;235.8;236.8;...
235.6;235.6]
??? Error using ==> vertcat
All rows in the bracketed expression must have the same
number of columns.
Disregard the first Matrix I gave.
What am I doing wrong?
Réponses (1)
The problem is in the sixth row:
238.8;239.0;241.8;241.8;239.6,...
The comma at the end should be a semicolon. The comma creates horizontal concatenation, not vertical concatenation. The horizontal concatenation throws the error.
With that change, it works:
v = [242.8;241.4;243.8;243.0;243.6;...
240.0;243.6;242.8;242.2;242.0;...
243.4;242.8;243.4;242.6;239.2;...
240.8;240.6;241.0;239.8;239.2;...
241.2;242.0;238.6;237.2;237.4;...
238.8;239.0;241.8;241.8;239.6;...
239.0;239.8;239.2;241.8;239.2;...
239.2;238.4;238.6;240.0;239.6;...
240.8;241.2;237.8;237.6;236.6;...
238.6;238.0;239.2;238.0;238.4;...
237.4;237.0;238.4;238.4;237.2;...
236.8;237.4;236.8;237.8;238.8;...
235.8;235.2;236.8;238.0;240.4;...
241.4;236.6;235.2;235.2;236.6;...
233.0;235.6;235.2;232.6;232.2;...
233.2;234.6;234.6;235.8;237.2;...
235.0;235.0;237.0;238.6;234.6;...
234.8;235.4;235.2;235.8;236.8;...
235.6;235.6]
.
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!