MATLAB: How to fill values between two values. filling values A = [1 0 0 0 2 0 3 0 0 0 0 4 0 5 ….] B = [1 1.25 1.5 1.75 2 2.5 3 3.2 3.4 3.6 3.8 4 4.5 5 ….] Is there a function for this? Best Answer You could use interp1:>> A = [1,0,0,0,2,0,3,0,0,0,0,4,0,5];>> X = find(A);>> B = interp1(X,A(X),1:numel(A))B = 1.0000 1.2500 1.5000 1.7500 2.0000 2.5000 3.0000 3.2000 3.4000 3.6000 3.8000 4.0000 4.5000 5.0000 Related SolutionsMATLAB: Making one matrices dimension same as other [rows1 colm1]=size(h);[rows2 colm2]=size(k);% You can change the way depending on sizes of h and k% Also which direction you want to pad zerosk_revise=[k;zeros(rows1-rows2,colm1)]; 5.1000 3.8000 1.9000 0.4000 6.4000 2.9000 4.3000 1.3000 4.3000 3.0000 1.1000 0.1000 5.4000 3.0000 4.5000 1.5000 0 0 0 0 0 0 0 0There are more smart way to do the same, please follow padarray MATLAB: I have a matrix A of order 3 X 7 and C is a matrix made B=A\CB = 1.0000 0.3445 -0.0766 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.7943 0.7679 0 0 0 -0.0000 -0.1388 0.3086>> A*Bans = 1.0000 7.0000 13.0000 2.5000 1.0000 -0.5000 0.2500 2.0000 16.0000 Related QuestionBelow is the probabilistic neural network for classification, but it is not working fine. Can someone help to improve it? especially how to recalculate training, validation and test performance.Suppose I have a matrix of size(3,3).This is up-scaled by 2 making it (6,6).So there would be a number of vacant values between each element of the initial (3,3) matrix.Then how do you fill up the 0 values in addmatrixR by bicubic/liner interpolatiHow to extract specific rows from one array to another arrayHow to extract a distribution from a 2d histogramHow to compare the elements of a matrix and fill another matrix with the elements of a vectorDifficulty finding euclidean distance to match
Best Answer