vertcat while filtering data
3 次查看(过去 30 天)
显示 更早的评论
Hello all,
I am having difficulties getting to add to a matrix. I created an empty matrix named "bob". I have a 6 column matrix called "RPLIDARdata" that I want to pull the entire row out if a condition is met and put it in "bob". I want it to concatenate into the new matrix. "r" is the variable that I want to check and "i" is the iteration number in a for loop. The code I have tried goes as follows:
if r(i) > 1
RPLIDAR(i,:) = bob(i,:);
end
(Yes, I know that my first code wouldn't have worked.) it throws this error
%Index exceeds matrix dimensions.
Error in fcmclusteringandoccupancymap (line 28)
RPLIDAR(i,:) = bob(i,:);
I discovered vertcat so I entered this code in
vertcat(RPLIDARdata(i,:),bob)
I get this error
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in fcmclusteringandoccupancymap (line 28)
vertcat(RPLIDARdata(i,:),bob);
Can anyone please help me with this? I would like for this to concatenate
采纳的回答
更多回答(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!