Advertisement
Guest User

MATLAB Day 1 & 2

a guest
Oct 17th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. %-- 10/16/2019 2:29 PM --%
  2. a = 5
  3. a = 5;
  4. isinteger(a);
  5. b = 'hello';
  6. a;
  7. a
  8. b
  9. num = 7;
  10. sum = 3 + 4;
  11. num + sum
  12. which imshow
  13. clear
  14. clear;
  15. whos num;
  16. b = 'hello';
  17. whos b;
  18. a = 7;
  19. whos a;
  20. x = 15.66
  21. x = single(x);
  22. x
  23. clear
  24. iskeyword
  25. clc
  26. clf
  27. imshow('rice.png');
  28. imshow('rice.png');
  29. clf
  30. clc
  31. type imshow
  32. clc
  33. which foo
  34. which imshow
  35. ver
  36. clc
  37. array = [15,56,45,31,556,645];
  38. array
  39. save file1.mat array
  40. load('file1.mat')
  41. ls
  42. load('file1.mat')
  43. load('file1.mat', 'array')
  44. clc
  45. help imshow
  46. clc
  47. doc array
  48. lookfor array
  49. clc
  50. imshow('peppers.png');
  51. clc
  52. RGB = imread('peppers.png');
  53. RGB
  54. BW = imread('rice.png');
  55. BW
  56. imshow('rice.png');
  57. I = rgb2gray(RGB);
  58. imshow(I);
  59. clc
  60. %-- 10/17/2019 4:06 PM --%
  61. 5+6
  62. clc
  63. num = [1,2,3;4,5,6;7,8,9]
  64. clc
  65. clc
  66. num(8)
  67. clc
  68. num3 = [1:4; 5:8; 9:12; 13:16]
  69. num3(8)
  70. vector1 = [15,56,54,89,63]
  71. A = diag(vector1)
  72. b = eye(3)
  73. b = eye(3,5)
  74. c = true(3)
  75. c =true(3,2)
  76. c = false(3,2)
  77. who c(1,2)
  78. whos c(1,2)
  79. whos c
  80. d = ones(2,4)
  81. d = zeros(2,4)
  82. whos d
  83. m = magic(3)
  84. m = magic(5)
  85. cell1 = {15,'A',46,'C',65;16,'C',98,96,'D'}
  86. cell1(1,2)
  87. cell1(1,4)
  88. cell1(1,5)
  89. cell2 = {[56 89 78 78];[13 69 78 95];['a' 'b' 'c' 'd']}
  90. cell2(1)
  91. cell2(1,1)
  92. whos cell1
  93. cell2{1,1}
  94. cell2{1}
  95. cell1{1}
  96. whos cell1{1}
  97. field1 = 'f1'; value1 = zeros(1,10);
  98. field2 = 'f2'; value2 = {'a', 'b'};
  99. field3 = 'f3'; value3 = {pi, pi.^2};
  100. field4 = 'f4'; value4 = {'fourth'};
  101. s = struct(field1,value1,field2,value2,field3,value3,field4,value4)
  102. s
  103. s(1)
  104. s(1).f2
  105. s(2).f1
  106. s(2).f2
  107. s(2).f3
  108. s(1).f3
  109. 5 == 5
  110. 5 == 6
  111. 6 ~= 5
  112. 6 ~= 6
  113. 5 > 6
  114. 6 <6
  115. 6 <= 6
  116. 1 & 1
  117. 1 & 03
  118. 1 & 0
  119. clc
  120. 0 | ~0
  121. 0 | ~1
  122. 0 && ~1
  123. 0 && ~0
  124. 1 && ~0
  125. clc
  126. ide = eye(3)
  127. NOTide = ~ide
  128. whos NOTide
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement