Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Undefined operator '-' for input arguments of type 'cell'.
1 回表示 (過去 30 日間)
古いコメントを表示
for(i=1:size(Ftrain,1))
dist(1,:)=sum(abs(Ftrain(1,:) - Ftest));
end
0 件のコメント
回答 (1 件)
Image Analyst
2018 年 11 月 4 日
編集済み: Image Analyst
2018 年 11 月 5 日
You can't subtract cells. You can subtract the contents of cell if they are numeric. So you need to use braces. See the FAQ: https://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
Try it this way:
for(i=1:size(Ftrain,1))
dist(1,:)=sum(abs(Ftrain{i,:} - Ftest));
end
Ftest must be of the same type as the contents of the cell, e.g. both doubles.
3 件のコメント
Image Analyst
2018 年 11 月 5 日
編集済み: Image Analyst
2018 年 11 月 5 日
But what's IN the cell? Inside each cell should also be a 1-by-2 vector. and you need to specify both row and column. Like this
thisCellsContents = Ftrain{i, someColumnNumber}
dist(i,someColumnNumber=sum(abs(thisCellsContents - Ftest));
Perhaps you need another inner loop over column.
Attach Ftrain and Ftest in a .mat file if you still need more help so I don't waste time guessing.
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!