フィルターのクリア

Getting "Undefined operator '*' for input arguments of type cell' error for my code

4 ビュー (過去 30 日間)
Hi, when I multiply A with A1 I am getting "Undefined operator * for input arguments of type cell' error for he below-mentioned code. Can somebody help me to fix it?
s = string({'CR';'E';'R';'S';'SR'})
s1 = s([2,5])' + (1:20)'
s1 = [s([2,3,2,4]) + [101;1;106;1];s1(:)] + (0:4)
d = {tril(ones(44,4),-1),diag(ones(20,1),-24)}
d{2} = d{2}(:,1:end-4)
dd = repmat({[d{:}]},1,5)
str = cellstr([s(1);s1(:)])
out = [{nan},str(:)';str, num2cell([zeros(1,221);[ones(220,1),blkdiag(dd{:})]]) ];
A= out(2:end,2:end);
A1= ( randn(221,1) * 0.1 ) + 0.45;
X1= A*A1;

採用された回答

KSSV
KSSV 2018 年 2 月 20 日
編集済み: KSSV 2018 年 2 月 20 日
A is a cell and A1 is a matrix/ double. You need to convert A into matrix to multiply.
Use:
X1 = cell2mat(A).*A1 ;

その他の回答 (1 件)

Star Strider
Star Strider 2018 年 2 月 20 日
It is easiest to convert ‘A’ to a double array, then do the multiplication:
X1 = cell2mat(A)*A1;
Convert ‘X1’ to a cell later if necessary.

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by