Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

why am I get this error?: ??? Subscripted assignment dimension mismatch.

1 Ansicht (letzte 30 Tage)
Ata
Ata am 25 Feb. 2013
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
why am I get this error?:
??? Subscripted assignment dimension mismatch.
Error in ==> Untitled2 at 6
C(i,1) = B(67:74);
My code is:
C = zeros(1230,1);
for i=1:1230
B = A(i,1);
B = char(B);
C(i,1) = B(67:74);
end
A is a <1230*1> cell, which there is a text in every cells!
I've also checked my code like this and it works!
for i=1:1230
B = A(i,1);
B = char(B);
Z = B(67:74);
end
but I want to save All 1230 items in a matrix!
Thanks
  1 Kommentar
Walter Roberson
Walter Roberson am 12 Mär. 2013
You are trying to store a sequence of characters into a single element of a numeric matrix. What is your goal here? Are you really trying to store the numeric interpretation of those characters into that location?

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 25 Feb. 2013
Bearbeitet: Azzi Abdelmalek am 25 Feb. 2013
You can 't do this
C(i,1) = B(67:74);
Try this
C = cell(1230,1);
for i=1:1230
B = A(i,1);
B = char(B);
C(i,1) = cellstr(B(67:74));
end
  1 Kommentar
Ata
Ata am 12 Mär. 2013
It didn't work!
I did it by writing the characters in a text file, and then importing them!
Thanks...

Diese Frage ist geschlossen.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by