i m getting 'subscript assignment dimension mismatch' in my code in 'line 18'

1 回表示 (過去 30 日間)
aparna mishra
aparna mishra 2020 年 2 月 25 日
回答済み: M 2020 年 2 月 25 日
M=2;
N=64;
Np=4;
Nframes=1000;
D = round((M-1)*rand((N-Np),Nframes));
Mod=pskmod(D,M);
Mod=Mod';
pilot=3+3j;
pilotdata=zeros(1000,64);
% p=1:1000;
u=0;
% k=1;
for p=1:1000
for q=1:13:52
pilotdata(p,q)=pilot;
for J=q+1:q+12
k=q-u:q-u+11;
pilotdata(p,J)=Mod(p,k);
u=u+1;
end
end
end
n=49;
for m=(53:64)
pilotdata(p,m)=Mod(p,n);
n=n+1;
end

採用された回答

M
M 2020 年 2 月 25 日
You have a problem of dimensions at line 18:
pilotdata(p,J)=Mod(p,k);
At the first iteration, it holds: p = 1, q = 1, J = 2
pilotdata(1,2) is a scalar value (dimension 1 x 1) but k = 1 : 12
Mod(p,k) is a vector of dimension 1 x 12
You cannot assign this value to a scalar value.
What was your objective here ?

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by