Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Question

Status
Not open for further replies.

Drewage

Bioengineer
Aug 11, 2005
2
Hi, I apologize for the simplicity of my question, but I'm just learning to use matlab. I'm currently making a script to print out commands.

I was wondering how to properly display set characters
i.e.: disp 'Hello'
but then have a changing variable in the same line. Every time I try to use a variable in the command I get an
"n =" such and such. I'd rather it just display the number it is associated with and move on. Do I need to use a different command?
Thanks for any help
 
Replies continue below

Recommended for you

ty the function form call to display
i.e.

for iCount = 1 : 3
disp( [ 'Hello World! Day ', int2str( iCount ) ] )
end
 
Now, who said Matlab was tricky?

Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Here's an altern code:

fprintf('Hello World! Day %g\n',1:3)

It depends on your need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor