MATLAB: Combining elements in an array concatenation Hi, I have a logical array, A = [1 0 1]. How can I combine the elements horizontally, so that I have B = [101]? Any help would be appreciated! SS Best Answer To turn your logical array into a double array, any mathematical operation on it will do the conversion. Here I used ‘+’:A = logical([1 0 1])An = +Awhos A*A = 1 0 1An = 1 0 1 Name Size Bytes Class Attributes A 1x3 3 logical An 1x3 24 double Related SolutionsMATLAB: 2D logical indexing of 1D array for resulting 2D array A = {'A'; 'B'; 'C'};ind = logical([1, 1; 0 0; 0 1]);indD = double(ind) .* (1:numel(A)).'; % Auto-expand, >= R2016bB = cell(size(ind));B(ind) = A(indD(ind)) MATLAB: How to call any element of array If x is your array, thenany(x(:)==0)will return logical true if any elements are zero. Related QuestionHow to convert a table into a structureSum two arrays using logical indicesDecimal array from logical arrayHow to sum over 3 dimensional cell array, where each cell also contains cellsConverting a Data Array into a Larger Array Given a Logical Array
Best Answer