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
27 views (last 30 days)
Show older comments
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 Comments
Steven Lord
on 4 Apr 2024
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
on 4 Apr 2024
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?
Answers (1)
DGM
on 4 Apr 2024
Edited: DGM
on 4 Apr 2024
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 Comments
See Also
Categories
Find more on Shifting and Sorting Matrices 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!