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:
convert vectors to scalars

Subject: convert vectors to scalars

From: Monika

Date: 26 Nov, 2013 01:15:12

Message: 1 of 2

Hi,

I have problem with matlab
??? Operands to the || and && operators must be convertible to logical scalar
values.

Error in ==> program_glowny88 at 288
    if (kaszel > smiech && kaszel > krzyk && kaszel> chrzakanie)

How should I convert vectors to scalars in my program. I don't have numbers only words (cough, grunt, laugh, speach)

Subject: convert vectors to scalars

From: Sargondjani

Date: 26 Nov, 2013 17:14:07

Message: 2 of 2

"Monika " <monikal88_88@o2.pl> wrote in message <l70sn0$hg7$1@newscl01ah.mathworks.com>...
> Hi,
>
> I have problem with matlab
> ??? Operands to the || and && operators must be convertible to logical scalar
> values.
>
> Error in ==> program_glowny88 at 288
> if (kaszel > smiech && kaszel > krzyk && kaszel> chrzakanie)
>
> How should I convert vectors to scalars in my program. I don't have numbers only words (cough, grunt, laugh, speach)

the problem is that some of the operators kaszel, smiech, etc. are not scalars but vectors

if you type: size(kasyel) i bet you dont get rows:1, columns: 1. i am not sure what you intend to do, but you should convert the code such that the logical give a scalar 0 or 1. that means that comparing two vectors will not work...

Tags for this Thread

No tags are associated with 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