Dot indexing is not supported for variables of this type???

1 次查看(过去 30 天)
for i = 1: n
distance(i) = sqrt((sink(1)-site(i, 1)).^2+ (sink(2)-site(i,2)).^2);
Etx(i) = bit * (b + g * distance(i).^2);
E(i) = E0 - Etx(i);
for rr = 2: 10
count = 1;
%slope(i) = (centers(2)-site(i,2))/(centers(1)-site(i,1));
format long;
E(i).tx(rr) = E(i)-E(i).tx(rr-1);
if E(i).tr(rr) <= 90/100*E0
count = count+1
rr;
end
end
end
Why is output "Dot indexing is not supported for variables of this type."?
  5 个评论
sagun subedi
sagun subedi 2020-9-25
E(i).tx(rr) = E(i)-E(i).tx(rr-1);
This is the line where i get error.
The expected output is also a numeric variable.
Sindar
Sindar 2020-9-25
编辑:Sindar 2020-9-25
So, let's say E is:
[1 2 3]
How does anything called 'tx' come into play?
Etx is an entirely separate variable. Is it possible you mean something like this?
Etx(i) = E(i)-Etx(i);

请先登录,再进行评论。

回答(1 个)

the cyclist
the cyclist 2020-9-25
Complete guess here. Are you simply trying to multiply the two variables? If so, then
E(i).*tx(rr-1)
Just using a dot, by itself, is a syntax with a different use.

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by