matlab - how to convert from type logical to matrice -


function matb = mbin_init n=6; p=4; sm=1; while(sm>0)     matbin=rand(p,n)>=0.5;     sv = sum(matbin,2)==0;     sm = sum(sv); end matb.matbin = matbin ; end 

this function create random binary matrices of size(p,n). have created other search if there colomn of zeros in matrix1 @ position p, if yes matrix2 take column of zeros in same position p.

function [ matb1 ] = replace( ) matbin1 = mbin_init(); matbin2 = mbin_init(); indexcolonnenulle = 0; i=1:4    if sum(matbin1(:,i)) == 0         indexcolonnenulle = i;    end end if(indexcolonnenulle > 0)     matbin2(:,indexcolonnenulle) = 0; end matb1.matbin2 = matbin2; end 

an error appear when executing these functions!! undefined function 'sum' input arguments of type 'struct'.

error in replace (line 6) if sum(matbin1(:,i)) == 0

what have please?? thanks


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -