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

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.
Do you mean that length() of data_masukan is 96 ?

댓글을 달려면 로그인하십시오.

답변 (2개)

Matt J
Matt J 2013년 8월 3일
편집: Matt J 2013년 8월 3일

0 개 추천

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
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에 대해 자세히 알아보기

질문:

2013년 8월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by