Filter löschen
Filter löschen

what is the error here?

1 Ansicht (letzte 30 Tage)
Amr Hashem
Amr Hashem am 15 Mai 2015
Beantwortet: Walter Roberson am 17 Mai 2015
data1 = [data1,(text(k,6))];
Error using horzcat CAT arguments dimensions are not consistent.
Error in data1 = [data1,(text(k,6))];
  4 Kommentare
Amr Hashem
Amr Hashem am 16 Mai 2015
this is the contets of datatext and text
datatext 5*6 cell text 8*6 cell
i want the answer to be:
ans 5*8 cell
Amr Hashem
Amr Hashem am 16 Mai 2015
Bearbeitet: per isakson am 16 Mai 2015
any help, this is the code
for Q=1:length(querymdr)
for k=1:length(text)
if datatext{Q,1}==text{k,1}
datatext = [datatext,(text(k,6))];
end
end
end

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 17 Mai 2015
You need to find an empty position in datatext(Q,:) to assign into. For example,
nextslot = find(cellfun(@isempty,datatext(Q,:)));
if isempty(nextslot)
nextslot = size(datatext,2);
end
datatext{Q,nextslot} = text{k,6};
This will grow datatext wider if necessary in order to handle the new information.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by