# How to deal with This type of variable does not support indexing with points

My code is as follows
cvx_begin
variables W(M,M,K) R(K,K)
S=0;W_temp=0;
for k=1:K
h_k(:,k)=h_Bk(:,k)+G’*Theta’*h_rk(:,k);
H_k(:,:,k)=h_k(:,k)*h_k(:,k)’;
S=S+R(k,k);
end
maximize S
subject t0
for j=2:K
for s=j:K
W_temp=W_temp+H_k(:,:,j)*W(:,:,s);
end
for k=1:j-1
pow_pos((exp(R(k,j))-1)real(A_t(k,j)),2)+…
pow_pos((real(trace(W_temp)+noise))/real(A_t(k,j)),2<=2
real(trace(H_k(:,:,j)*W(:,:,k)));
exp(R(k.j))>exp(R(k,k));
end
end
cvx_end

A_t(k,j) is the initial value。

Can someone help me? How to solve it？`Preformatted text`

`exp(R(k.j))>exp(R(k,k));` violates CVX"s rule due to having `exp` on LHS of `>`. But `exp` is monotonic, so this can be reformulated as `R(k.j) > R(k,k)`. Note that CVX will interpret `>` as being `>=`. If you really need strict inequality, write it as `R(k.j) >= R(k,k) + small_positive_number`, where `small_positive_number` is a little larger than solver feasibility tolerance. So perhaps `1e-5`.

Can you please translate the error message into English.

This type of variable does not support indexing with points.

I don’t see why you would get that error at that statement. Did you change something else in the program?

Just prior to the statement which generated the error message, insert the line
`R` and tell us what it show.

If that doesn’t resolve things, please show us an entire MATLAB session starting with a fresh session. And copy and paste the entire session, with error message into a post, using Prefromatted text icon. It should be a K by K cvx variable (affine expression). But maybe somehow it’s not.

However, there is still an error. This type of variable does not support indexing with points.

You forgot to include `H_Bk` It is good practice, which you apparently didn’t do, to take what you think is a reproducible example, and enter it in a new MATLAB session to verify it s not missing anything (unless you defined something in a startup file). That way you don’t take up more of busy people’s time than necessary.

Just prior to the statement which generated the error message, insert the line
`R`
and tell us what it shows.

It should be
R =
cvx real affine expression (K by K matrix)

But maybe somehow it’s not.

Is anything shown for
`which -all R`

If so, perhaps there is a conflict.

I’m very sorry I didn’t understand you at first. I added `R`, which shows the cvx real affine expression (8x8 matrix). I just found that I wrote punctuation ‘,’ as’. '. After modification, there is no such error. Thank you very much for your answer.

In English language MATLAB/CVX that error message is
`Dot indexing is not supported for variables of this type`
which would have tipped me off, because every once in a while I type `.` instead of `,` and my vision is not always good enough to notice it, and then I get the error message. Now I use a large front size in MATLAB command window than I used to. But I never entered the CVX code,in MATLAB, because I first entered the data calculations preceding cvx_begin which produced an error message, so I stopped… So I only saw the small front in my browser and not the bigger font in MATLAB. But yeah, I should have noticed it.