Share :

How to extract two columns from a matrix in a sequence of 6 columns in matlab
By : Frank Air
Date : March 29 2020, 07:55 AM
Hope that helps Basically I have a <96x659 double> matrix and I want to extract 1st and 2nd column , then 8th and 9th, then 15th and 16th column and so on.. So I want each 2 columns in a step of 6 . I hope I was clear enough. I'm newbie in matlab . in advance! , All you really need to do is construct the list of columns you want: code :
columns = [1:7:size(matrix,2)+1, 2:7:size(matrix,2)+1];
submat = matrix(:, columns);
submat = matrix(:, sort(columns));

Change matrix columns and get the number of lines of a submatrix with all elements equals
By : Christoph Gummersbac
Date : March 29 2020, 07:55 AM
To fix this issue The problem you mention can be known as the Largest Square Block Problem You can find several topics related to this with solutions : code :
typedef struct s_max
{
t_uint16 val_max_;
t_uint16 idx_max_;
} t_max;
t_max largest_square_block(t_uint8 *grid, const t_uint16 h, const t_uint16 w)
{
t_uint16 up, upleft, left;
t_uint16 val_max = 0;
t_uint16 idx_max = 0;
t_uint16 *counter = (t_uint16 *) malloc(w * h * sizeof(t_uint16));
counter[0] = grid[0];
for (t_uint i = 1; i < w * h; i ++)
{
up = upleft = left = 0;
if (grid[i] != YOURMAGICNUMBER)
{
if (i >= w)
up = counter[i  w];
if (i % w > 0)
{
left = counter[i  1];
if (i >= w)
upleft = counter[i  1  w];
}
counter[i] = 1 + min3_uint16(up, upleft, left);
if (counter[i] > val_max)
{
val_max = counter[i];
idx_max = i;
}
}
}
free(counter);
t_max data_max;
data_max.val_max_ = val_max;
data_max.idx_max_ = idx_max;
return data_max;
}

Perform operation on grouped columns of a matrix
By : Malcolm C
Date : March 29 2020, 07:55 AM

perform calculation on all combinations of columns of a matrix
By : WP II
Date : October 13 2020, 06:00 AM

How to perform a calculation for all columns of a matrix?
By : Mark Taylor
Date : October 03 2020, 11:00 PM

