This screencasts gives an example of a nested FOR loop in a MATLAB program and how to create it based on a written algorithm. Also introduces the SIZE and ...
I found this very helpful, but I felt that there were a few commands that
were used but not fully explained:
"fprintf", "%0.0f", and ".\n"
I do not know where these came from and what they do (aside from if they
are used exactly the same as in this case).
Thanks!
+Alexander Maltagliati Hello, "fprintf(formatSpec,A1,...,An)" is a function that writes data to a file. - formatSpec is encased by apostrophes ' ', and essentially allows you to format the output of a string containing formatting operators.Formatting Operators is this" %0.0f." Formatting operators start with %, and ends with a conversion character. It's in fprintf to represent the variable. I talk more about that after this paragraph. The conversion character he used was "f", which stands for "Floating-point number," which is a precision operator that specifies the number of digits after the decimal. There other Conversion characters you should make yourself familiar with. Ex: "d" stands for double integer, which is base 10. So, about fprintf representing the place of a variable. Essentially, Matlab reads the formatSpec and it creates an array where all the formatting operators are within the formatSpec , and then reaches the end of formatSpec. Then it reads the variables An which it then replaces with the formatting operators respectively.Ex: A1 = A; A2 = B; fprintf( 'This is formatting operator 1: %c, and this is formatting operator 2: %c', A1, A2 );>> This is formatting operator 1: A, and this is the formatting operator 2:BIf we switch the position of A1 and A2, then:>> This is formatting operator 1: B, and this is the formatting operator 2:ABecause the order of the variables matter. %c stands for single character, and you could have used %s, which stands for string of characters. "\n" stands for new line. He uses it to create a new line after each iteration of the for loop, or else it would have been hard for us to read. EX2: If he didn't use \n the output would be formatted like this: >> The entry -5 is odd.The entry -7 is odd...What I said here is very general, and is missing a lot of information, but I hope it makes sense. From now on, you should use MATLAB to look up the documentation. If you highlight and right click on fprintf k then click on "Help with selection" it will open up the documentation. IF you don't have access to MATLAB, then you can easily access the documentation from here: //www.mathworks.com/help/
Branching structures in MATLAB- IF-ELSE
This is the first of several screencasts on basic MATLAB programming. We focus here on branching structures, particularly the IF-ELSE-END construction and ...
Thank you!! You translated the MATLAB commands to what they are in plain
English & broke down the segment so I can understand clearly. I know I'm
not stupid! Having a good teacher really helps.This is only my intro. to
your videos, but it's a shining glint of promise that I shall pass my
MATLAB course. I love seeing patterns, problem solving, dissecting app's
etc., but my prof. is extremely tough to follow--I know I"ll be teaching
myself most of the material..notsomuch w/your videos! Thank you!
I have a question, I have a matrix M= [12 58 9 6 5; 5 8 6 4 8; 8 5 6 8 5]
and a variable called max = 10, now, i need to compare every element of the
matrix with the max variable and every element that is greater than max i
have to square it, any ideas how to do it?
Hi there cn anyone help me with my work... i'll put the question... the
digit 0 to 9 be associated with the alphabets A to J as follows 0-j 1-h 2-a
3-c 4-e 5-g 6-i 7-f 8-b 9-d write a matlab program that prompts the user to
input a seven digit telephone number and then displays a list of all
letters that can be formed from the number. for example 7848979 begins
:fbebdfd, fbebddf, fbebfdd there is the question
Hi UW, I am planning to buy the latest version of matlab, I have one that I
bought maybe 6 or 7 years ago, are there things in programming that I did
before (which I don't remember) that I could not do in the new version, or
we can still do that and obviously much more? or what problem do you know I
may encounter??? thanks
xfunction alpha %First we define a matrix a for the letters a =
['JHACEGIFBD']; %Input 7 digit telephone number using 'input' function and
store in matrix e for n = 1:7, b = input('\nPlease enter a 7 digit number
(after each number press enter): '); e(n) = b; end it is not working how do
i do????? plzz help
Your videos are great and have helped a lot so far but you need to get your
mic positioning right especially considering the force at which it seems
you apply to the keys as the clacking from them is way too loud,
distracting and annoying. This one is very bad.
Third of four videos introducing GUI development in matlab. This video deals with callback functions and how to set them up to interact with objects on the GUI.
I think it has to do with being able to differentiate between the types of event that can occur - for example was a button pressed but not released, etc. I'm not sure about this though.
I'm trying to generate code that generates an immediate response induced by
pressing a key; more specifically I'd like to make a ball move around my
figure with the use of the arrow keys. I know i need to incorporate GUI's
and this callback method seems like a step in the right dirction, but i'm
not dealing with buttons.. any advice? Thanks so Much!
Hello.
Thank you so very much for sharing you knowledge this approach.
I am quite new to matlab but I wonder about eg_fun, does it has to be
writen in a file eg_fun.m or can it be included in the same file as
everything els?
This won't make a lot of sense if you don't know the difference between a matlab script and a function, so look that up first!eg_fun is a function and it can included in a different file if that file is also a function. However a matlab script cannot contain function code.
Plotting functions of two variables in MATLAB (Part 1)
Plotting functions of two variables in MATLAB (Part 1)
+sawyer tom Hi,I found a 74% OFF coupon to Learn Matlab Udemy courseCouponcode: MATLAB25https://www.udemy.com/learn-matlab/?couponCode=MATLAB25
Matlab Introduction (with Control Systems Focus)
This video will give you an introductory tutorial of Matlab. The focus of the video is towards a university level control course. You will be shown some of the ...