Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Weird publish behavior

Subject: Weird publish behavior

From: Stefano Naclerio

Date: 27 Sep, 2007 09:02:39

Message: 1 of 5

Hi everyone,

I got recently a strange behavior with the publish function.
My code creates a m-file with embedded html tags: this file
is then passed to "publish" in order to generate the html.
The part of the code which fails is the publish command, and
it is something like

%% Create html
options.evalCode = 'false';
options.outputDir = 'OutputPathName';
publish(fullfile(InputPathName,FileName),options);

Where FileName is my m-file with embedded html.

The problem I get is that if I choose to store the output in
the current directory (where all the main scripts are
located), it works; if I choose a different location it fails!!
In both cases there is a previous routine which creates if
necessary the required directories!

The error I get is:

??? Operands to the || and && operators must be convertible
to logical scalar values.

Error in ==> publish at 109
elseif
~strcmpi(strrep(fullPathToScript,'/',filesep),which(file))
&& ...

Any idea of the problem source?!?

Thanks everyone!

Stefano

Subject: Re: Weird publish behavior

From: Stefano Naclerio

Date: 27 Sep, 2007 09:20:11

Message: 2 of 5

I think is a kind of bug. I fixed the problem with this trick:


root = cd;
cd(PathName);
publish(fullfile(PathName,FileName),options);
cd(root);

and I get everything correct. It seems like publish needs to
have the input file in the current directory...
I hope this can help,

Stefano

Subject: Re: Weird publish behavior

From: Matthew Simoneau

Date: 27 Sep, 2007 16:20:24

Message: 3 of 5

I think I see what's going on here. Instead of saying:

   options.evalCode = 'false';

try this:

  options.evalCode = false;

This option should be the scalar logical "false", and not
the char array "false".

Even so, you should be getting a better error message here.

Subject: Re: Weird publish behavior

From: Stefano Naclerio

Date: 28 Sep, 2007 08:16:38

Message: 4 of 5

You are right! I misled 0 (or false()) with the string 'false'.
But... I still don't understand why it doesn't give problems
if you move the current directory to the directory where the
input is located...
Thanks!

Stefano

Subject: Re: Weird publish behavior

From: Matthew Simoneau

Date: 28 Sep, 2007 15:22:17

Message: 5 of 5

&& always wants an expression that evaluates to a scalar
logical and 'false' doesn't, which is the error message
you're seeing. In the situation that's working for you, the
&& short-circuits and the second half is never evaluated.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/logicaloperatorsshortcircuit.html

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
error message Matthew Simoneau 28 Sep, 2007 11:25:10
publish Stefano Naclerio 27 Sep, 2007 05:05:06
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics