how to make size arguments for reshape function be real integer?
古いコメントを表示
i have error at reshape function for RS Encoder program. like this:
Error using reshape
Size arguments must be real integers.
Error:
data_realize = reshape(data_acak,8,length(data_acak)/8)';
from syntax i think that's right.
but i don't know if my 'data_acak' is not real integers. cause 'data_acak' is form:
data_masukan=randi(12*8,1);
D=length(data_masukan);
State=[1 0 0 1 0 1 0 1 0 0 0 0 0 0 0];
for k=1:D
fdB=bitxor(State(14),State(15));
State=[fdB State(1:end-1)];
data_out(k,1)=bitxor(data_masukan(k,1),fdB);
data_acak = data_out(k,1);
end
EDIT: if i check one by one, value from: data_masukan is 76, data_acak is 76 and value equation length(data_acak)/8 is 0.1250. and that is not integer. but at notice for Reed Solomon Encoder is needed in a decimal.
if i change equation like length(data_acak)*8 or only length(data_acak), i get warning To RESHAPE the number of elements must not change.
so what should i do how to make "data_acak" at 'data_realize' be real integers but also like a notice for RS encoder?
thank you
2 件のコメント
Matt J
2013 年 8 月 3 日
if i check one by one, value from: data_masukan is 76, data_acak is 76
Is data_masukan really supposed to be a scalar? If so, why do you need a loop over k=1:D to process it? Since D=1, the loop will only do 1 iteration.
Walter Roberson
2013 年 8 月 3 日
Do you mean that length() of data_masukan is 96 ?
回答 (2 件)
Since D=1, you have length(data_acak)/8 equal to 0.125, which is not an integer. Presumably, D is not supposed to be 1, but it's not clear from your code what it should be.
Walter Roberson
2013 年 8 月 3 日
You have
data_acak = data_out(k,1);
which should probably be
data_acak(k) = data_out(k,1);
But then it is not clear what difference you intend there to be between data_acak and data_out
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!