MATLAB: WAT

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024

Комментарии •

  • @muhammadsuleman3854
    @muhammadsuleman3854 3 года назад

    This video is old but at point 4:27
    The reason why Matlab gives a 1x0 empty matrix is that whenever sum is given a 2D matrix. It sums all the elements in the columns
    So it gives []
    If you do sum(a, 'all')
    It will return 0.
    In 0x2 matrix you have two columns hence the [0 0].

  • @cmvandrevala
    @cmvandrevala 9 лет назад

    Great video! I have used Matlab for years, and I still learn new things about it every day!

  • @antondevey
    @antondevey 9 лет назад +8

    Actual Wat starts at 4:00

  • @GreaterJan
    @GreaterJan 5 лет назад +3

    MATLAB is a programming language designed by mathematicians who have never used a real language, down to its godawful UI.
    My 2 favorite wats:
    #1
    a = (1 2)
    a(4) = 4
    The result in any other language would be an index error but here it is (1 2 0 4)
    #2
    You can omit any number of 'end' statements. This bit me in an assignment where I ended a function but forgot to end a for loop, leading to the end applying to a for loop instead:
    function ...
    for ...
    (Do something repeatedly)
    (Do something once)
    end

  • @kevgoeswoof
    @kevgoeswoof 4 года назад

    I just got this recommended out of nowhere. 🤔 But only a JavaScript WAT can top this video. xD

  • @aestrivex
    @aestrivex 8 лет назад

    Most of the odd semantics in the video are well explained, but does anyone have any idea why sums of empty matrices works like this?

    • @CourtOfWinter
      @CourtOfWinter 8 лет назад +1

      +aestrivex I guess sum works column-wise, except when the height of the matrix is 1, in which case it's row-wise.
      So sum(zeros(0,2)) ist [sum([]), sum([])], while sum(zeros(2,0)) is zeros(1,0) + zeros(1,0) which works as normal vector addition, adding up all (so...0) values and resulting in a vector of the same size as the original two.

  • @marco_foco
    @marco_foco 9 лет назад +3

    I spent several years working on MATLAB (from 2007 to 2014, not counting university years), and then one day this happened:
    marcofoco.com/?p=22
    After that, I decided to resign.

    • @GemNewman
      @GemNewman  9 лет назад

      +Marco Foco That's pretty great.

    • @CourtOfWinter
      @CourtOfWinter 8 лет назад

      +Marco Foco I don't get the confusion. You made eval into a variable by setting the 67th position to 4. (The char 'C' is 67...in all languages I know).

    • @marco_foco
      @marco_foco 8 лет назад

      It sound perfectly reasonable that you can overload a built-in function, and completely prevent the function to be called.
      Silly me for spending all those years studying software engineering...

  • @thebratcave
    @thebratcave 10 лет назад

    Fragged guy ivy theft

  • @LReBe7
    @LReBe7 3 года назад

    1:25 WROOOONG, you NEVER get used to a 1 indexed language, NEVER EVER EVER EVER!