I am working on a project on Adaptive Video Coding for wireless channels.
So far I have an encoded bitstream similar to the one below (but more than 800,000 bits long):
>>bitstr =
11010100000101000100000000010101000000010100010001001
>>
Now I am trying to modulate it in Simulink using QPSK and import the result back into MATLAB. The problem I am facing is importing 'bitstr' into simulink, I have tried to use the 'From Workspace' block (simin) but it gives the following error:
"Invalid matrix-format variable specified as workspace input in 'untitled/From Workspace'. The matrix must have two dimensions and at least to columns......."
How can I fix this error, is there any other way to import the bitstr into simulink? I am not very good in simulink, so I need a good explanation to understand how it works.
Thanks
is it because I use dec2bin to get the bit stream.
Yes, since you are using dec2bin the output is a string of bits which is
not usable by the From Workspace block.
The block only works with decimals/doubles.
Try using de2bi if you have the comms toolbox also or a element by element
conversion on the string using str2num.
As an example,
>>bits = de2bi(200, 'left-msb')
and now use "bits" as the variable in the From workspace block.
or
>>bitstr = dec2bin(200);
>>for i=1:length(bitstr)
>> bits2(i) = str2num(bitstr(i));
>>end
and now use "bits2" as the variable in the From workspace block.
>>isequal(bits, bits2)
hth,
Amit
"Sohaib Mansoor" <contact...@gmail.com> wrote in message
news:gs5341$3r5$1...@fred.mathworks.com...
the for loop is working well, but I have one little problem. Its taking too much time because the size of the string is more than 800,000 bits. Is there any way the same operation can be done but without the loops, to save time?
Sohaib