output chiqish



Download 16,58 Kb.
bet1/3
Sana29.06.2022
Hajmi16,58 Kb.
#717736
  1   2   3

2.6 OUTPUT
Chiqish
MATLAB dan natija olishning ikkita oddiy usuli mavjud
■ Entering a variable name, assignment, or expression on the command
line, without a semicolon
■ Using the disp statement (e.g., disp( x ))
2.6.1 The disp statement
The general form of disp for a numeric variable is
disp( variable )
When you use disp, the variable name is not displayed, and you don’t get a
line feed before the value is displayed, as you do when you enter a variable
name on the command line without a semicolon. disp generally gives a neater
display.
You can also use disp to display a message enclosed in apostrophes (called a
string). Apostrophes that are part of the message must be repeated:
disp( ’Pilate said, ’’What is truth?’’’ );
To display a message and a value on the same line, use the following trick:
x = 2;
disp( [’The answer is ’, num2str(x)] );
The output should be
The answer is 2
Square brackets create a vector, as we have seen. If we want to display a string,
we create it; that is, we type a message between apostrophes. This we have
done already in the above example by defining the string ’The answer is ’.
Note that the last space before the second apostrophe is part of the string. All
the components of a MATLAB array must be either numbers or strings (unless
you use a cell array—see Chapter 11), so we convert the number x to its string
representation
with the function num2str; read this as “number to string.”
You can display more than one number on a line as follows:
disp( [x y z] )
The square brackets create a vector with three elements, which are all displayed.
The command more on enables paging of output. This is very useful when
displaying large matrices, for example, rand(100000,7) (see help more for
details). If you forget to switch on more before displaying a huge matrix, you
can always stop the display with Ctrl+Break or Ctrl+C.

Download 16,58 Kb.

Do'stlaringiz bilan baham:
  1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish