% Discretize solution: find rounded solution with minimal squared error with respect to measurements function [discreteOutput]=modifySolution(fractionalOutput,M,y) % sort the fractionalOutput from highest to lowest [junk,index] = sort(fractionalOutput,'descend'); index(find(junk<0.2)) = []; currXround = zeros(size(fractionalOutput)); errorRound = zeros(1,length(index)); val = ones(1,length(index)); % round the top 1 to i entries in x and for each of them calculate the squared error for i=1:length(index) if abs(fractionalOutput(index(i))-1)