Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

transpose.txt 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. % This use of ' is for transpose:
  2. mat2x2 = [1 2; 3 4]'; % transpose of a matrix
  3. cell2x2 = {1 2; 3 4}'; % transpose of a cell
  4. v=mat2x2'; % transpose of a variable
  5. v2 = (v')'; % two transpose operations
  6. foo = 1.'; % transpose of scalar 1.
  7. % Nonconjugate transpose uses .'
  8. mat2x2 = [1 2; 3 4].'; % of a matrix
  9. cell2x2 = {1 2; 3 4}.'; % of a cell
  10. v=mat2x2.'; % of a variable
  11. v2 = (v.').'; % two operations
  12. foo = 1..'; % of scalar 1.
  13. bar = v.''.'.''; % mix of transpose operations
  14. % single quote strings:
  15. sq1 = 'a single quote string';
  16. sq2 = ...
  17. ' abcd '; % single quote string starting at column 1
  18. sq3 = ['a','bc']; % array of single quote strings
  19. sq4 = {'a','bc'}; % cell of single quote strings
  20. % double quote strings
  21. dq1 = "a double string";
  22. dq2 = ...
  23. " abcd "; % double quote string starting at column 1
  24. dq3 = ["a","bc"]; % array of double quote strings
  25. % Mixture of strings and transpose
  26. c2 = {'a','bc'}'; % transpose of a cell of strings
  27. s = ['a','bc']'; % you can transpose vectors of strings (they are really 'char' arrays)
  28. s = s'; % and transpose back
  29. % (s')' is a double transpose of a string
  30. x = [(s')', ' xyz ', 'a single quote in a string'', escape \', two quotes in a string'''''];
  31. s2 = "abc\"def""ghi"; % newer versions of MATLAB support double quoted strings
  32. s3 = (["abc", "defg"]')'; % transpose a vectors of quoted string twice
  33. s4 = "abc"!; % transpose a quoted string
  34. b = true' + false'; % boolean constants