MATLAB: How to display a value in first column the second column number of times displying the valuesreplem alternative suppose i have a column vector x=[1 2 3 4]; and y=[2 3 3.5 4] i want the output as xy=[1 1 2 2 2 3 3 3 3 4 4 4 4]; the number 3.5 can be rounded off to a whole number. here ive taken it as 4. Best Answer repelem(x, round(y)) Related SolutionsMATLAB: I want to extract the value of clustersCentroid from clusterXY with come error tolerance, were clusterXY is cell variable and clusterCentroid is double varaible cell2mat(cellfun(@mean, clustersXY(:,1), 'uniform', 0)) MATLAB: How to calculate the mean for the number of occurances u=unique([C{:}]);n=cell2mat(cellfun(@(x) histc(x,u),C,'uni',0));n(n==0)=nan;x=cell2mat(arrayfun(@(x,n) repmat(x,1,n),u,round(nanmean(n)),'uni',0));>> x = 2 2 2 2 3 3 4 4 5>> Related QuestionHow to evaluate an array of function handles at different pointsHow to use ismember to assign values from one cell array to another cell arrayHow to multiply simplest way this two vectorsA Matrix full of ArraysHow to add n cellarrays of one image with their corresponding n cellarraya of another image(elementwise)
Best Answer