All Questions
Tagged with binary-data matlab
28 questions
0
votes
0
answers
31
views
Correctly read binary data encoded in variable-lengths
I'm trying to read a binary data file containing time-series data in Matlab.
Sample data: [23,-10,47,19,-417,-434,-1,29,11,22,23,6,18,13,-383]
Command: fopen(filename,'r','ieee-le');
When I read the ...
4
votes
1
answer
172
views
What is the fastest method to extract multiple numbers embedded in a 32 bit binary number in Matlab
I have a 32 bit number (uint32) that contains four numbers in the following manner:
Var1 is in bits 32:31
Var2 is in bits 30:22
Var3 is in bits 21:13
Var4 is in bits 12:1
The following code works ...
0
votes
1
answer
214
views
MATLAB fread 24 bit convert to Python
I am trying to convert some MATLAB code to Python.
The code reads audio data from serial:
out = fread(s,s.bytesavailable,'uint8'); % [255 205 217 255 212 60 255 207 132 255 ...]
'out' is then saved ...
1
vote
0
answers
156
views
Forecast binary response with MATLAB glmval?
(I have a very similar setup to this post here.)
ytrain and Xtrain are my training data where ytrain is a column of 1's and 0's and Xtrain is a matrix of explanatory variables. ytrain and Xtrain have ...
2
votes
0
answers
59
views
Optimize algorithm that generates the number of units in each binary state
TL;DR: I need to find all possible combinations of N row vectors (of size 1xB), whose row-wise sum produces the desired result vector (also of size 1xB).
I have a binary matrix (1 or 0 entries only) ...
0
votes
1
answer
560
views
Matlab return bytes from fread
I am trying to read binary data that is saved in evenly spaced blocks in a file. Each data block begins with a record header that contains variable information about reading the file. The header is ...
0
votes
1
answer
44
views
Reducing matrix size in 2D using KNN
I have a large binary matrix. I want to reduce the size of this matrix by using knn-approximation. What my idea is to cluster the matrix in groups of 4 neighbors and replace the group with a 1, if ...
2
votes
1
answer
65
views
Obtaining the position of a random 1 in an array of 0's in MATLAB
I have a matrix which is initialized as follows:
stateAndAction = zeros(11, 4);
Over time the matrix will be updated so that at a given index, there will be a one. So at any given time we could have ...
0
votes
0
answers
743
views
Delta compression, port matlab code to python
The following matlab function decodes a signal delta-encoded:
% Method : DeltaCompression
% Description : Decode delta compressed signal
%
function data = DeltaCompression(file, data)
if ftell(...
2
votes
2
answers
104
views
Combination and Multiplying Rows of array in matlab
I have a matrix (89x42) of 0's and 1's that I'd like to multiply combinations of rows together.
For example, for matrix
input = [1 0 1
0 0 0
1 1 0];
and with 2 combinations, I ...
1
vote
1
answer
113
views
Concatenate binary strings obtained from decimal to binary conversion
I want to place the binary equivalent number for each element side - by side i.e, the final matrix Concatenated_A would be of size m by nbits*n where [m,n] = size(A);
A = [5, 5, 4, 10, 4;
10, ...
1
vote
1
answer
256
views
Matlab : Binary to decimal conversion using symbols from clustering algorithm
q = 2;
k= 2^q;
x1 = [0.0975000000000000, 0.980987500000000, -0.924672950312500, -0.710040130079246];
for i = 1 : length(x1)
[idx_centers,location] = kmeans(x1',q);
end
temp = idx_centers;
for ...
3
votes
1
answer
1k
views
Faster way for decimal to binary conversion
Considering an array of integer numbers:
X = [1, 3, 3, 3,2,3 ,1,1,2,3]
I want to convert each number to its 4 bit binary equivalent. I have done the following, but the result is not correct. It ...
2
votes
2
answers
1k
views
MATLAB reading bit by bit from a binary file
I am able to successfully read in a .wav file with the following code.
[y,Fs,nbits,opts] = wavread('MyFile.wav','native')
So I now know from the file the data which is stored in y, the sample rate (...
0
votes
3
answers
1k
views
MATLAB reading to the end of a binary file
I think the solution will be quite simple for somebody with some MATLAB knowhow however I do not know how to do it.
I have a binary file that I am reading with fread and I am reading the first 4 ...