Whos To Find The Variable Types
Whos To Find The Variable Types
Commands:
Change the path: create a folder, copy the windows path of the forlder and paste it in the matlab
explorer to get into that folder, Some alternative commands for above instructions are: >>cd ‘path’
>>pwd >>ls
Right click on the command history to create Scripts and save it as .m and to run it play it
And you can hit left pane to breakpoint to step by step run of the program and Quit it to close the
debug. To end the debug >>dbquit
Comment is % and semi colon is used to stop giving in line variables’ measures.
If Script is saved as .mlx then it is live Scripts and the benefit is the result would show in the script itself
as you are coding without asking for run. Live Script is used for Presentation and lectures. You can
import image and headings as a points of the lectures and presentation and no require for comments.
By the way you still have to click PLAY to see the results in line in the live scripts.
To read the image from the root directory, the command is >>imread(‘.tif’); and then need that to show
as a result >>imshow(variablecontainingimageread)
a=[1 2 9 4 5]
disp(a)
b=length(a)
a=1:10
a=[1 2 3; 5 6 7; 8 9 10]
c=max(max(a)) is 9
c=min(min(a)) is 1
a=a./2
CellArrays.mlx that means at each element place there can be different type of variavle
Now to put value in this cell, and you can know it by whos
>>a{1,3}=b; now you can injecting b’s value into a’s 3 rd element.
outputArg1 = inputArg1;
outputArg2 = inputArg2;
end
here function name example should be same as the file name and the result would be shown in the
function output but you can still get the result if you ask for disp(result);
now error comes if there are two output arguments in the function but in your main you arranged the
prog
ram in a way that it is looking for one result. It does not matter what name is given in the output
argument but its important to know how many arguments are coming out.
close all; to close the hold on and all other previous plots if you are trying to make a different plot I the
program next to it.
For bargraph.m
For one bar For multi bar
clc; to clean previously plotted graphs if any clc; to clean previously plotted graphs if any
clear; for previous graphs to clean if any before clear; for previous graphs to clean if any before
a=[10 20 30 40]; a=[10, 29; 20, 40; 30, 40; 40, 60];
bar(a, ‘r’); bar(a);
xticks(1:4); xticks(1:4); if you want to make it horizontal then
xticklabels({’10-20’, ’20-30’, ’30-40’, ’40-50’}); just change to y
xticklabels({’10-20’, ’20-30’, ’30-40’, ’40-50’}); if
horizontal just y
legend(‘Before Training’, ‘After training’);
xlabel(‘Age Group’); if horizontal just y
ylabel(‘Performance’); if horizontal just x
For pie graphs
clc;
clear;
a=[10, 20, 30, 40];
pie(a);
title(‘Market Share’);
legend(‘A’, ‘B’, ‘C’, ‘D’);
Types of images
Channel separation
Edge detection