how to make size arguments for reshape function be real integer?
Show older comments
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 Comments
Matt J
on 3 Aug 2013
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
on 3 Aug 2013
Do you mean that length() of data_masukan is 96 ?
Answers (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
on 3 Aug 2013
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
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!