Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Just for fun.

Subject: Just for fun.

From: Paul Alexander

Date: 21 Dec, 2010 01:05:22

Message: 1 of 13

What is matlab's favorite vegetable?

Subject: Just for fun.

From: proecsm

Date: 21 Dec, 2010 01:25:34

Message: 2 of 13

"Paul Alexander" <psalexander@alaska.edu> wrote in message <ieougi$j3v$1@fred.mathworks.com>...
> What is matlab's favorite vegetable?

doc why

Subject: Just for fun.

From: Matt Fig

Date: 21 Dec, 2010 03:04:11

Message: 3 of 13

"Paul Alexander" <psalexander@alaska.edu> wrote in message <ieougi$j3v$1@fred.mathworks.com>...
> What is matlab's favorite vegetable?

Celery? (cell-array)

Subject: Just for fun.

From: Jan Simon

Date: 21 Dec, 2010 09:41:39

Message: 4 of 13

Dear Paul,

> What is matlab's favorite vegetable?

Ok, we solve this typical homework question for you - as an exception.

1. Have you read the Getting Started section of the documentation and why is the "S" of "Started" in upper case?
2. Did you read the HELP and DOC of Matlab's vegetable toolbox functions?
3. No, I would not implement this using EVAL.
4. Please consider that neither "matlab" nor "favorite" nor "vegetable" are integers, so you must take some roundoff into account. Either by "if abs(vegetable - favorit.vegetable) < 10*eps" or by using Bruno's excellent FEX submission ISFAVORITEF.
5. Perhaps this helps:

% ------------------------------- 8< --------------------------
function WhatIsMatlabsFavoriteVegetable
clock = evalin('caller', 'clock'); % Consider seasonal effects!
eval(sprint('Month%s = clock(%d)', '_', 3));
if abs(eval(sprintf('Month%s', '_')) - 12) < 100*eps
   TheActualAnswer = 'gingerbread';
else
   Possible = {'pumpkin', 'calabash', 'cucurbit', 'gourd', 'squash'};
   Mixed = Possible(randperm(numel(Possible))); % Or the faster SHUFFLE
   TheActualAnswer = cell2mat(Mixed(1));
end
assignin('base', 'ans', TheActualAnswer);
% ------------------------------- >8 --------------------------

Sorry - I did not find a way to do this without EVAL, so please forget the third point.

Under Matlab 6 it was possible to use ASSIGNIN and the mex function mexPutVariable to create a variable called "return". But with a modern Matlab version, this efficient method is impeded. What a pitty, it was so useful to have access to all these cute keywords.

Kind regards, Jan

Subject: Just for fun.

From: Sean de

Date: 21 Dec, 2010 15:49:43

Message: 5 of 13

"Matt Fig" wrote in message <iep5fb$fit$1@fred.mathworks.com>...
> "Paul Alexander" <psalexander@alaska.edu> wrote in message <ieougi$j3v$1@fred.mathworks.com>...
> > What is matlab's favorite vegetable?
>
> Celery? (cell-array)

Very nice!

How about?
switch chard

Subject: Just for fun.

From: John D'Errico

Date: 21 Dec, 2010 16:40:29

Message: 6 of 13

"Sean de " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <ieqian$6f$1@fred.mathworks.com>...
> "Matt Fig" wrote in message <iep5fb$fit$1@fred.mathworks.com>...
> > "Paul Alexander" <psalexander@alaska.edu> wrote in message <ieougi$j3v$1@fred.mathworks.com>...
> > > What is matlab's favorite vegetable?
> >
> > Celery? (cell-array)
>
> Very nice!
>
> How about?
> switch chard

Not bad either. I might suggest the caret. ^

John

Subject: Just for fun.

From: ImageAnalyst

Date: 21 Dec, 2010 17:04:44

Message: 7 of 13

Well for the Image Processing Toolbox, it's peppers and onions - they
have two standard demo images of these included in the toolbox.

Subject: Just for fun.

From: Sean de

Date: 21 Dec, 2010 17:16:07

Message: 8 of 13

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <99714ee0-2a42-4343-bd48-60c86857f72a@u3g2000vbj.googlegroups.com>...
> Well for the Image Processing Toolbox, it's peppers and onions - they
> have two standard demo images of these included in the toolbox.

But peppers are technically a fruit since they have seeds. Good call with onions!

Subject: Just for fun.

From: dpb

Date: 21 Dec, 2010 18:37:15

Message: 9 of 13

Sean de wrote:
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message
> <99714ee0-2a42-4343-bd48-60c86857f72a@u3g2000vbj.googlegroups.com>...
>> Well for the Image Processing Toolbox, it's peppers and onions - they
>> have two standard demo images of these included in the toolbox.
>
> But peppers are technically a fruit since they have seeds. Good call
> with onions!

Not to be picky but some of what are commonly called vegetables _are_
seeds--peas, corn, etc., etc., etc., ... It's not truly a
taxonomy-specific term but a common-usage one.

Back on topic (but it's a stretch in pronunciation for a veggy; fruits
commonly would be associated)...

pi

--

Subject: Just for fun.

From: Walter Roberson

Date: 21 Dec, 2010 20:51:23

Message: 10 of 13

On 10-12-21 12:37 PM, dpb wrote:
> Back on topic (but it's a stretch in pronunciation for a veggy; fruits
> commonly would be associated)...
>
> pi

Dear diary! whats cooking at home? Have a view! To startup, sort yourself out
a good log, a stem, and some roots, wrap them in a floor crust, brush with
time and a ribbon of rose, and fix up a single unique nice round pie, ready to
zip in to the gallery oven. Bake for 20 min, pause, rotate, bake for 25 min
more until the beep. set in shading mesh to cool.

warning! unwrap carefully! slice open; do not squeeze!

May contain a trace of tar and a residue of rats, but its magic flavor will
make you quiver.

Subject: Just for fun.

From: Bruno Luong

Date: 21 Dec, 2010 22:39:07

Message: 11 of 13

Hat off to Walter, LOL

Bruno

Subject: Just for fun.

From: Jan Simon

Date: 22 Dec, 2010 09:49:06

Message: 12 of 13

Dear Walter,

Excellent! Jan

PS. Please do not invite me for dinner. I'm sure I'm allergic to one of the ingrediences.

Subject: Just for fun.

From: Dan Seal

Date: 7 Jun, 2013 15:36:10

Message: 13 of 13

Walter Roberson <roberson@hushmail.com> wrote in message <ier40o$hco$1@nrc-news.nrc.ca>...
> On 10-12-21 12:37 PM, dpb wrote:
> > Back on topic (but it's a stretch in pronunciation for a veggy; fruits
> > commonly would be associated)...
> >
> > pi
>
> Dear diary! whats cooking at home? Have a view! To startup, sort yourself out
> a good log, a stem, and some roots, wrap them in a floor crust, brush with
> time and a ribbon of rose, and fix up a single unique nice round pie, ready to
> zip in to the gallery oven. Bake for 20 min, pause, rotate, bake for 25 min
> more until the beep. set in shading mesh to cool.
>
> warning! unwrap carefully! slice open; do not squeeze!
>
> May contain a trace of tar and a residue of rats, but its magic flavor will
> make you quiver.


fid = fopen('bakingRecipe.txt'); a = fread(fid); fclose(fid);
text = char(a)';
words = regexp(text,'\w*','match');
bool = cellfun(@(x) exist(lower(x))==2 | exist(lower(x))==5 | exist(lower(x))==6, words);
funcs = unique(words(bool));

clc
fprintf('There are %d different MATLAB functions in the text:\n',length(funcs))
disp(char(funcs'))

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us