Develop a matlab program that generates a 10x10 array of random integers and uses appropriate flow-control structures to search the grid and determine the maximum and minimum
4 次查看(过去 30 天)
显示 更早的评论
Develop a matlab program that generates a 10x10 array of random integers and uses appropriate flow-control structures to search the grid and determine the maximum and minimum value. Furthermore, the program should also output both the original and sorted version of the 10x10 array.
2 个评论
Steven Lord
2024-4-4
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
DGM
2024-4-4
It's only mentioned that the array is supposed to be sorted, but it's not clear how it's suppsed to be sorted. Is the result a vector? Is it a 2D array with sorted rows? Sorted columns?
回答(1 个)
DGM
2024-4-4
编辑:DGM
2024-4-4
Want to see if your TA can tell you didn't do your own homework? Here's a fair test.
[~,A] = system('od -vAn -N200 -tu2 < /dev/urandom');
A = reshape(sscanf(A,'%d'),1E1,[])
A_sorted = intersect(A,A)
[Amin Amax] = bounds(A_sorted)
I'm going to assume "output" means "dumps to console", and that "appropriate flow control statements" means "none".
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!