# MATLAB: Inserting a row in a matrix defined by a vector

displacement plotMATLABrow of zeros

Hi guys!
I am fairly new to matlab – actually just atarted using it on my bachelor this monday 🙂
I'm trying to make a 8×3 matrix containing the displacement in each DOF output from a finite element calculation, that I am trying to make generel.
But when i want to plot the result on a plot of the original frame/truss the matrix sizes does not match obviously.
I have a 8×2 matrix containing the x and y input coordinates, which I can plot easily. But i only get displacements in a 5×2 matrix because 3 of the nodes are fixed, and not included in the stiffness matrix used to compute the displacement output.
To make the plot i need to be able to automatic generate 3 rows of zeros in my output matrix on the positions where the fixed support output is missing.
Get it?
Like this:
Node coordinates:(x    y) =[0    0,0    1,1    1,2    1,2    0,3    1,4    1,4    0]Fixed nodes: [1 5 8]
Which after a couple of calculations gives me the right displacement output but only in the free nodes.
Fictional output(x,y) = [ 2 2 , 3 3 , 4 4 , 6 6 , 7 7 ]
But to plot the output i need a matrix sized 8×2 instead of 5×2. So i need an automated way to put a row of zeros on the place of every fixed node, so i end up with af automated output like this:
New output(x,y) = [ 0 0 , 2 2 , 3 3 , 4 4 , 0 0 , 6 6 , 7 7 , 8 8 ]
But generated direcly from the fixed node vector! I can make the matrix by changing it manually, but i cannot seem to make it automated.
Can anyone help?

FictionalMatrix =  [2 2; 3 3; 4 4; 6 6; 7 7];FixedNodes = [1 5 8];NewOutput = zeros(8,2);NewOutput(setdiff(1:8,FixedNodes),:) = FictionalMatrix;