Updating a zeroized matrix with provided row vectors
1 次查看(过去 30 天)
显示 更早的评论
So I'm not sure if this can be done, but this is what I'm trying to do. I have a matrix (Force) that I've initialized to zero, it will always have three columns, but the rows will vary based on the nnd variable (determined by user input). Also based on user input is the Nodal Loads matrix, where Column 1 is the node number and column 2:4 are nodal loads. As you can see, there are nodes missing in the user input, meaning that if the user didn't input a value, then that nodal row remains zero. Is there a way to take the user input for Nodal_Loads and update the information into the Force matrix? My desired endstate is shown below. Thanks for the help.
Nodal_Loads = [2 0 -1000 0] %example 1
or
Nodal_Loads = [1 0 0 40; 3 -1000 0 40; 4 0 2000 40; 5 0 0 40; 8 1000 -2000 40; 9 0 0 40] %example 2
nnd = 9 %can be any number based on user input (I'll just say 9 for this example)
Force = zeros(nnd,3)
(Desired Endstate) %example 2
Force matrix now looks like:
Force = [0 0 40; 0 0 0; -1000 0 40; 0 2000 40; 0 0 40; 0 0 0; 0 0 0; 1000 -2000 40; 0 0 40]
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!