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:
text there is a yellow line under

Subject: text there is a yellow line under

From: wahyoe Unggul

Date: 1 Apr, 2011 16:46:06

Message: 1 of 13

in some code I use some functions, such as "strvcat" and "fprintf" in the text there is a yellow line under it and reads like this:
"strvcat">> "Constructing a cell array is a faster using STRVCAT"
"fprintf">> "This earnest call of fprintf That Produce output will from be printed"

I wanted to ask, what is the purpose of under the yellow line?
thanks
Wahyoe

Subject: text there is a yellow line under

From: ImageAnalyst

Date: 1 Apr, 2011 16:51:25

Message: 2 of 13

Wahyoe:
It's to let you know where m-lint is making suggestions about how to
improve your code.

Subject: text there is a yellow line under

From: Steven_Lord

Date: 1 Apr, 2011 16:58:14

Message: 3 of 13



"wahyoe Unggul" <wahyoe_slipnot@yahoo.co.id> wrote in message
news:in4vge$nu7$1@fred.mathworks.com...
> in some code I use some functions, such as "strvcat" and "fprintf" in the
> text there is a yellow line under it and reads like this:
> "strvcat">> "Constructing a cell array is a faster using STRVCAT"
> "fprintf">> "This earnest call of fprintf That Produce output will from be
> printed"
>
> I wanted to ask, what is the purpose of under the yellow line?

Code Analyzer underlines certain sections of your code to offer suggestions
about how you can improve that code or to indicate that there is an error in
that code.

http://www.mathworks.com/help/techdoc/matlab_env/brqxeeu-151.html#brqxeeu-156

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: text there is a yellow line under

From: wahyoe Unggul

Date: 1 Apr, 2011 17:09:04

Message: 4 of 13

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <608aa0cc-9bd5-4390-9c05-7e8ab410be7d@w7g2000yqe.googlegroups.com>...
> Wahyoe:
> It's to let you know where m-lint is making suggestions about how to
> improve your code.

hi Image
if I change it so happens
%==========================================
strvcat>> STRVCAT
"Warning: Could not find an exact (case-sensitive) match for 'STRVCAT'.
C: \ Program Files \ MATLAB \ R2010a \ toolbox \ matlab \ strfun \ strvcat.m is a case-insensitive match and
Will Be Used instead.
You can improv the performance of your code by using exact
name matches and That We therefore recommend you update your
usage accordingly. Alternatively, you cans disable this warning using
warning ('off', 'MATLAB: dispatcher: InexactCaseMatch').
This warning will of changed from an error in future releases. "
%=============================================
fprintf>> fprintf
"? Undefined function or method 'fprintf' for input arguments of type 'double'."

but if I do not alter this code to run, it's just that I feel weird because there are yellow lines at the command

Subject: text there is a yellow line under

From: dpb

Date: 1 Apr, 2011 17:39:23

Message: 5 of 13

On 4/1/2011 12:09 PM, wahyoe Unggul wrote:
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message
> <608aa0cc-9bd5-4390-9c05-7e8ab410be7d@w7g2000yqe.googlegroups.com>...
>> Wahyoe:
>> It's to let you know where m-lint is making suggestions about how to
>> improve your code.
>
> hi Image
> if I change it so happens
> %==========================================
> strvcat>> STRVCAT
> "Warning: Could not find an exact (case-sensitive) match for 'STRVCAT'.
> C: \ Program Files \ MATLAB \ R2010a \ toolbox \ matlab \ strfun \
> strvcat.m is a case-insensitive match and
> Will Be Used instead.
> You can improv the performance of your code by using exact
> name matches and That We therefore recommend you update your
> usage accordingly. Alternatively, you cans disable this warning using
> warning ('off', 'MATLAB: dispatcher: InexactCaseMatch').
> This warning will of changed from an error in future releases. "
> %=============================================
> fprintf>> fprintf
> "? Undefined function or method 'fprintf' for input arguments of type
> 'double'."
>
> but if I do not alter this code to run, it's just that I feel weird
> because there are yellow lines at the command

So, read the advice and follow it... :)

In the first case, you've used the uppercase form for the strvcat()
function and it's telling you that's not a good idea. Use

"strvcat" instead of "STRVCAT" and that one will go away.

You don't show the actual code for the fprintf error but there's an
error there somewhere; possibly an illformed formatting string. That
one will prevent you from running the m-file

--

Subject: text there is a yellow line under

From: wahyoe Unggul

Date: 1 Apr, 2011 19:18:04

Message: 6 of 13


>
> So, read the advice and follow it... :)
>
> In the first case, you've used the uppercase form for the strvcat()
> function and it's telling you that's not a good idea. Use
>
> "strvcat" instead of "STRVCAT" and that one will go away.
>
> You don't show the actual code for the fprintf error but there's an
> error there somewhere; possibly an illformed formatting string. That
> one will prevent you from running the m-file

A1='1 = James';
A2='2 = Jhony';
A3='3 = Angle lite';
A4='4 = Patrick kluivert';
display_type=strvcat(A1,A2,A3,A4);
on "strvcat" there are orange lines

Subject: text there is a yellow line under

From: dpb

Date: 1 Apr, 2011 19:50:01

Message: 7 of 13

On 4/1/2011 2:18 PM, wahyoe Unggul wrote:
>
>>
>> So, read the advice and follow it... :)
>>
>> In the first case, you've used the uppercase form for the strvcat()
>> function and it's telling you that's not a good idea. Use
>>
>> "strvcat" instead of "STRVCAT" and that one will go away.
>>
>> You don't show the actual code for the fprintf error but there's an
>> error there somewhere; possibly an illformed formatting string. That
>> one will prevent you from running the m-file
>
> A1='1 = James';
> A2='2 = Jhony';
> A3='3 = Angle lite';
> A4='4 = Patrick kluivert';
> display_type=strvcat(A1,A2,A3,A4); on "strvcat" there are orange lines

Yes, the first message told you that there are more efficient ways to do
this; namely use cell arrays.

display_type={A1;A2;A3;A4};

or

display_type={A1 A2 A3 A4}'; % if don't want to type the ";"

doc cellstr

--

Subject: text there is a yellow line under

From: wahyoe Unggul

Date: 1 Apr, 2011 21:09:07

Message: 8 of 13

dpb <none@non.net> wrote in message <in5aae$fca$1@dont-email.me>...
> On 4/1/2011 2:18 PM, wahyoe Unggul wrote:
> >
> >>
> >> So, read the advice and follow it... :)
> >>
> >> In the first case, you've used the uppercase form for the strvcat()
> >> function and it's telling you that's not a good idea. Use
> >>
> >> "strvcat" instead of "STRVCAT" and that one will go away.
> >>
> >> You don't show the actual code for the fprintf error but there's an
> >> error there somewhere; possibly an illformed formatting string. That
> >> one will prevent you from running the m-file
> >
> > A1='1 = James';
> > A2='2 = Jhony';
> > A3='3 = Angle lite';
> > A4='4 = Patrick kluivert';
> > display_type=strvcat(A1,A2,A3,A4); on "strvcat" there are orange lines
>
> Yes, the first message told you that there are more efficient ways to do
> this; namely use cell arrays.
>
> display_type={A1;A2;A3;A4};
>
> or
>
> display_type={A1 A2 A3 A4}'; % if don't want to type the ";"
>
> doc cellstr
Thank you very much,dpb
the code "printf" the problem is such that there are orange lines, and in the print, to the header "B" can not be separated
P=('Example : Matlab to Text')
B=(['OR' 'AND' 'FOR'])
A=rand(3)
AZ='example.txt'
fid=fopen(AZ,'w')
 fprintf(fid, '%10s\n',P)
 fprintf(fid, '%5s \n',B)
 fprintf(fid, '%5.0f %5.0f %5.0f\n',P)
 fclose(fid)

result
Example : Matlab to Text
ORANDFOR
   69 120 97
  109 112 108
  101 32 58
   32 77 97
  116 108 97
   98 32 116
  111 32 84
  101 120 116

I want to make
Example : Matlab to Text
OR AND FOR
   69 120 97
  109 112 108
  101 32 58
   32 77 97
  116 108 97
   98 32 116
  111 32 84
  101 120 116

Subject: text there is a yellow line under

From: dpb

Date: 1 Apr, 2011 22:28:15

Message: 9 of 13

On 4/1/2011 4:09 PM, wahyoe Unggul wrote:
...

> the code "printf" the problem is such that there are orange lines, and
> in the print, to the header "B" can not be separated
...

> B=(['OR' 'AND' 'FOR'])
...
> fprintf(fid, '%5s \n',B)
...

> ORANDFOR 69 120 97
...

> I want to make
> Example : Matlab to Text
> OR AND FOR 69 120 97
...

doc strcat % Read what it says about trailing spaces...

Again, cells are your friend for string handling...

 >> B={'OR ' 'AND' 'FOR'};
 >> sprintf('%5s', B{:})
ans =
   OR AND FOR
 >>

As for what m-lint thinks of your code, it's only guidelines, not cast
in stone although there's no reason to completely ignore its indications
that you could possibly be more succinct or more "Matlab-y" in style.

Generally, I worry only in something that will take quite a lot of time
to execute either because it will operate on large data sets or iterate
a large number of times or somesuch. A one-off set of titles isn't of
much real concern altho you may learn something about better programming
habits if you observe consistently what m-lint doesn't like.

--

Subject: text there is a yellow line under

From: ImageAnalyst

Date: 1 Apr, 2011 23:14:14

Message: 10 of 13

You can test your code easier with fid = 1. This will print it to the
command window instead of a file. This code will do what you want:

P=('Example : Matlab to Text')
B=(['OR' ' AND ' 'FOR'])
A=rand(3)
AZ='example.txt'
% fid=fopen(AZ,'w')
fid=1
 fprintf(fid, '%10s\n',P)
 fprintf(fid, '%5s \n',B)
 fprintf(fid, '%5.0f %5.0f %5.0f\n',P)
% fclose(fid)

Subject: text there is a yellow line under

From: wahyoe Unggul

Date: 2 Apr, 2011 05:03:05

Message: 11 of 13

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <68c660b3-f630-4afe-8e87-8d349cdca0e8@k15g2000vbp.googlegroups.com>...
> You can test your code easier with fid = 1. This will print it to the
> command window instead of a file. This code will do what you want:
>
> P=('Example : Matlab to Text')
> B=(['OR' ' AND ' 'FOR'])
> A=rand(3)
> AZ='example.txt'
> % fid=fopen(AZ,'w')
> fid=1
> fprintf(fid, '%10s\n',P)
> fprintf(fid, '%5s \n',B)
> fprintf(fid, '%5.0f %5.0f %5.0f\n',P)
> % fclose(fid)

hai image,
there are orange lines on "fprintif" and set the distance between the word "B" to conform are like below

I want to make
Example : Matlab to Text
OR AND FOR
69 120 97
109 112 108
101 32 58
32 77 97
116 108 97
98 32 116
111 32 84
101 120 116
thanks
wahyoe

Subject: text there is a yellow line under

From: ImageAnalyst

Date: 2 Apr, 2011 05:09:49

Message: 12 of 13

Probably because you misspelled fprintf as "fprintif".

To add more space, simply add more spaces to
B=(['OR', ' AND ', 'FOR'])

If the number of spaces you want to insert is contained in a variable,
then use sprintf().

Subject: text there is a yellow line under

From: wahyoe Unggul

Date: 2 Apr, 2011 06:19:05

Message: 13 of 13

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <5952fa4b-8eb0-427d-b859-920f7cbd9d08@w7g2000yqe.googlegroups.com>...
> Probably because you misspelled fprintf as "fprintif".
>
> To add more space, simply add more spaces to
> B=(['OR', ' AND ', 'FOR'])
>
> If the number of spaces you want to insert is contained in a variable,
> then use sprintf().

thanks image

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