我一直收到此错误消息无法执行赋值,因为类型 'tf' 的值无法转换为 'cell'?
I keep get this error message Unable to perform assignment because value of type 'tf' is not convertible to 'cell'?
num = [1];
dem = [1 1 0 0];
T=[0.1,0.5,2,3,4,20];
ind='A,B,C,D,E,F'
index=strsplit(ind,',')
for i=1:length(T)
for j=1:length(index)
index(j)= tf(num ,dem,'Inputdelay',T(i)); %% error is here
end
for plotId = 1 : 6
subplot(3,2,plotId), bode(index(j))
grid on;
title(['delay=',num2str(T(plotId))])
end
end
Blockquote problem is that i could not using index i heard about somthing call eval but i've got no idea
ft 返回的结果有很多属性,您必须指定您需要的属性:
for j=1:length(T)
results= tf(num ,dem,'Inputdelay',T(i));
index(j).num =results.num;
index(j).den =results.den;
index(j).Variable =results.Variable;
index(j).ioDelay =results.ioDelay;
index(j).InputDelay =results.InputDelay;
index(j).OutputDelay =results.OutputDelay;
index(j).Ts =results.Ts;
index(j).TimeUnit =results.TimeUnit;
index(j).InputUnit =results.InputUnit;
index(j).InputName =results.InputName;
index(j).InputGroup =results.InputGroup;
index(j).OutputName =results.OutputName;
index(j).OutputUnit =results.OutputUnit;
index(j).OutputGroup =results.OutputGroup;
index(j).Name =results.Name;
index(j).Notes =results.Notes;
index(j).UserData =results.UserData;
index(j).SamplingGrid =results.SamplingGrid;
end
我对 TensorFlow 了解不多,这确实是你问的问题,但你得到 error 的原因是变量的类型 index
变成 'cell array' 当你使用 strsplit
:
ind='A,B,C,D,E,F'
index=strsplit(ind,',')
ind =
'A,B,C,D,E,F'
index =
1×6 cell array
{'A'} {'B'} {'C'} {'D'} {'E'} {'F'}
因此,当您尝试 index(j) = tf(...)
时,您是在尝试将不是单元格的类型放入是单元格的变量中。 Matlab 不允许您这样做。有关元胞数组的更多信息:https://au.mathworks.com/help/matlab/ref/cell.html.
num = [1];
dem = [1 1 0 0];
T=[0.1,0.5,2,3,4,20];
ind='A,B,C,D,E,F'
index=strsplit(ind,',')
for i=1:length(T)
for j=1:length(index)
index(j)= tf(num ,dem,'Inputdelay',T(i)); %% error is here
end
for plotId = 1 : 6
subplot(3,2,plotId), bode(index(j))
grid on;
title(['delay=',num2str(T(plotId))])
end
end
Blockquote problem is that i could not using index i heard about somthing call eval but i've got no idea
ft 返回的结果有很多属性,您必须指定您需要的属性:
for j=1:length(T)
results= tf(num ,dem,'Inputdelay',T(i));
index(j).num =results.num;
index(j).den =results.den;
index(j).Variable =results.Variable;
index(j).ioDelay =results.ioDelay;
index(j).InputDelay =results.InputDelay;
index(j).OutputDelay =results.OutputDelay;
index(j).Ts =results.Ts;
index(j).TimeUnit =results.TimeUnit;
index(j).InputUnit =results.InputUnit;
index(j).InputName =results.InputName;
index(j).InputGroup =results.InputGroup;
index(j).OutputName =results.OutputName;
index(j).OutputUnit =results.OutputUnit;
index(j).OutputGroup =results.OutputGroup;
index(j).Name =results.Name;
index(j).Notes =results.Notes;
index(j).UserData =results.UserData;
index(j).SamplingGrid =results.SamplingGrid;
end
我对 TensorFlow 了解不多,这确实是你问的问题,但你得到 error 的原因是变量的类型 index
变成 'cell array' 当你使用 strsplit
:
ind='A,B,C,D,E,F'
index=strsplit(ind,',')
ind =
'A,B,C,D,E,F'
index =
1×6 cell array
{'A'} {'B'} {'C'} {'D'} {'E'} {'F'}
因此,当您尝试 index(j) = tf(...)
时,您是在尝试将不是单元格的类型放入是单元格的变量中。 Matlab 不允许您这样做。有关元胞数组的更多信息:https://au.mathworks.com/help/matlab/ref/cell.html.