Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I am getting this error Cell contents assignment to a non-cell array object..I m actually trying to create an array where the elements are functions

1 回表示 (過去 30 日間)
Samruddhi Pednekar
Samruddhi Pednekar 2016 年 4 月 4 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
my code is H = @(t) 1.*(t>=0 & t<=0.5)+... -1.*(t>=0.5 & t<=1)+... 0.*(t<0 | t>1); h =@(t) cell(k,1); for j = 0:5 for k=0:2.^j-1 i=2.^j+k+1; if i == 1 h{i}=@(t) 1; else val = H(2.^j-k); h{i}=@(t) 2.^(j/2).*val; end end end

回答 (1 件)

Dave Behera
Dave Behera 2016 年 4 月 6 日
From the error you are getting it seems, that you are adding your functions to something that is not a cell array. I assume that you are using the variable 'h' to hold those function handles. If so, you have not correctly defined it as a cell array:'
h =@(t) cell(k,1); % is not a cell array
h = cell(k,1); % this is correct

Community Treasure Hunt

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

Start Hunting!

Translated by