Info
此问题已关闭。 请重新打开它进行编辑或回答。
Finding a value (or not a value) inside a matrix
5 次查看(过去 30 天)
显示 更早的评论
I want to find a value or if a value is not inside of a matrix. Code so far. Will be using an if statement to do something if condition is met or do nothing if condition is not met.
clc, clear, close all
Bingo_board = randi([1 100],5,5)
x = randi ([1,100], 1)
0 个评论
回答(2 个)
Ameer Hamza
2020-10-22
Try this code
Bingo_board = randi([1 100],5,5)
x = randi ([1,100], 1)
if any(Bingo_board(:)==x)
disp('Match found.');
else
disp('No match found.');
end
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!