File Exchange

image thumbnail

Shakespeare quotes

version (5.29 KB) by Hannes Mogensen
Generate random shakespeare quote

1 Download

Updated 12 Aug 2016

View Version History

View License

Function generates a randomly chosen Shakespeare quote.
Suggested use: add function call secretly to co-worker's startup.m file in working directory.

Image credit:

Cite As

Hannes Mogensen (2021). Shakespeare quotes (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)


yes. works on my Mac, no problems.

Hannes Mogensen

Thanks for feedback. I will try to locate the error next time I come across a Mac, for the sake of generally being able to write platform-independent code.


Nope, that doesn't work either.

As ever, not really knowing what I'm doing, this worked -
Changed the apostrophes to double apostrophes (not double quote marks),
Stripped away most of the blank filler spaces in QUOTES,
Converted the variable QUOTES to cell structure,
used DISP instead of FPRINTF.
It works so I am back in Mac users' default state of ataraxy. :-)

Hannes Mogensen

@Warwick: I tried to fix the apostrophe issue, but could not test it myself.

Hath not Mac users eyes? Hath not Mac users hands, organs, dimensions, senses, affections, passions? Fed with the same food, hurt with the same weapons, subject to the same diseases, healed by the same means, warmed and cooled by the same winter and summer as a Linux user is? If you prick us, do we not bleed? If you tickle us, do we not laugh? If you poison us, do we not die?


As a Mac user, I am perhaps more sinned against than sinning. The apostrophe within a string is the problem but is fixed with a bit of editing
And an appreciative thank you to Stephen C.

Hannes Mogensen


Stephen Cobeldick

With my apologies to the great bard, from "Antony and Cleopatra":

What manner o' thing is your matrix?
It is shaped, sir, like itself, and it is as broad as it hath breadth. It is just so high as it is, and moves with its own values. It lives by that which index into it, and the elements once out of it, it transposes.
What colour is it of?
Of it own colour too.
'Tis a strange array.
'Tis so. And the dimensions of it being concatenated are not consistent.

Hannes Mogensen

@Warwick: You have not heard of the bard's great epos about inconsistent matrices?

I believe you have accidentally added or removed a character or whitespace somehwere in the quotes matrix - then you'll get this error message


Great idea but the returned quote I get is always "Dimensions of matrices being concatenated are not consistent." Probably not the bard's.

I've tried shakespeare(x) where x is various numbers; shakespeare(); shakespeare all with the above result. Presumably I have missed the obvious?

Stephen Cobeldick

Briliant. Fulfills all of my MATLAB-Shakespeare-Quote needs perfectly.

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!