saimun1

01. 1.1 Matlab sub-functions

Aug 13th, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.22 KB | None | 0 0
  1. % Only the first function can be accessed from outside
  2. function [a,s]= myRand(low, high)
  3. a=low+rand(low,high)*(high-low);
  4. s=sumAllElements(a)
  5. end
  6.  
  7. function summa = sumAllElements(M)
  8. v = M(:);
  9. summa = sum(v);
  10. end
Advertisement
Add Comment
Please, Sign In to add comment