Reading Flags in a matrix
Show older comments
I have this data from an input file below I have separated them by blocks the first block (rows 1 through 7) is my node block where column 4 are flags. When there is a 0 that means that the value in column 4 is a force and when there is a 1 that means the value in column 4 is a displacement.
1 3.0 0 0
2 2.0 0 0
3 0.5 1 0.001
4 0.5 0 5000
5 4.0 0 0
6 8.25 1 0
7 6.5 0 -2000
Right now I have this Code:
X = NodeBlock(:,3)
if X == 0
U = NodeBlock(:,X)
else X == 1
F = NodeBlock(:,X)
end
and its not working right, I just want it to compute that if X (the values in column 3) is 0 then Column 4 is a U (displacement) and vice versa for my Forces. I need this to help me set up my K Matrix in order for it to solve for either F or U.
Keep in mind that this is only sample data and the amount of nodes are variable which is why I am trying to keep it in vector format. The amount of columns are fixed
Thanks,
90% Newbie
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!