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: https://www.flickr.com/photos/cornie/1596598696
yes. works on my Mac, no problems.
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. :-)
@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.
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.
@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?
Briliant. Fulfills all of my MATLAB-Shakespeare-Quote needs perfectly.
Fixed inconsistent matrix error
Fixed bug: one apostrophe was not replaced by char(..) value
Added compatibility for Macintosh OS
Function description should start with capital letter