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 MOD commands as a side trip.
Amazon Auto Links: No products found.
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 MOD commands as a side trip.
Amazon Auto Links: No products found.
Author: RobertTalbertPhD
what does mod do??
Hi, -74% coupon to Learn Matlab course
https://www.udemy.com/learn-matlab/?couponCode=ML25
Sir, please tell me about loops that are used to take two inputs simultaneously and computing it: example-
fori=1:5
forj=1:5
fprintf(‘n take length 1:’);
fprintf(‘n take length 2:’)
%other computations
end
end
good job but speaking slower would make it easier to follow
I am about to lose my mind right now
I’ve been trying for 4 hours to create a matrix with nested for loops
the matrix should have the output
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
Basically repeating a row n times, I am going crazy with these nested loops since I have to create a 50×50 matrix using that method in which element (1,1) is -5 and element(1,50) is -5, so
-5 -4.8 -4.6 …………
-5 -4.8 -4.6 …………
-5 -4.8 -4.6 …………
-5 -4.8 -4.6 …………
My code is as follows:
x(1,1) = -5;
%Loop to create the x matrix
for i = 1:50
for j = 1:50
x(i+1,j) = x(i,j) + 0.2;
x(i+1,j) = x(i,j);
end
end
This constantly gives be a 2×1 matrix. What is going on, I don’t see ANYTHING wrong with this code
Please help, I am about to go insane
thank you so much
is it possible to save the resulting variables during the loop operation. for example for a loop from 1:5, i want to save all the generated variables during the iteration cycle under a different name. can it be done?
I am an absolute beginner in programming and I find this video very useful! Thank you very much!
supercool,you are my hero…btw is it macbook or mac book pro..???
k=1;
for j= 2:2:rlen2r
rl(j,:)=rf2ll(k,:);
rh(j,:)=rf2hl(k,:);
k=k+1;
end
for this code what is the value of this ” : ” , (k,:) Please give me details “?
say within a for loop defined as,
i=1:100
if …..
elseif…..
while…..
If I have a condition in the while loop that terminates the current history it is on and goes to the next history within the for loop… How would I do that? Say the condition is met in i=1, I want to terminate that loop if the neutron is lost and start, i=2.
Please help…
Thank you!
Hi there. there is more than one way.
– [1 2 3;4 5 6;7 8 9] each “;” starts a new row, so this end up being a (3*3) matrix.
– or use: a:b:c where a is your initial value, b is your step size, c is your final value.
– or use the command : magic(A) , if A=3 you end up having a 3*3 matrix and so on.
I hope this helps.
Thank you for not having an accent
Hello, i have wind speed data(per second) and i need a loop to calculate the average every 1 minute(60sec). 5.270.341rows 1column. Can you help me?
your tutorial videos are really helpful and precise,keep up the good work!!
https://youtu.be/wF5NrJacz4Q
what is the difference between using MOD and REM commands?
that was a great lesson from you and I admired you way of explaining the example, I am welling to have a chat with you about somthing that I need the help in it. Welling to have you answer soon
Thank you in advance
Z
Just curious how to use MATLAB to find the values of a symbol?
Giving a+c=30 and 2<= c-a<=10 Both a and c are within a function and I need to find the min and max values of a? Any help would be greatly appreciated
nice!
hello sir, can you help me to complete my thesis?
Shouldn’t num_rows=size(A,2)?? Because the output of the function gives you the number of rows.
How can a user enter an array of his own choice??What is the command for that? please answer
MOD function is almost like rem Function which also calculates remainder I guess.
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!
cool !
Molto interessante, suggerisco anche il corso grautito di “Corsi Consulenze NPR”, https://youtu.be/nc1zk0DAJn0
wonderful , great job 🙂
Can you please show how to solve a matrix of a 5×3 and have it in increase in the order of small to large.
Example [ 1 2 5
15 18 23 ]
Thank you.
neat
Very well presented! I wish it were explained this clearly when I was learning it!
Gr8! Was very helpful!
Hi Sir, can you create Matlab program for 2 input and 2 output using if else statement? Thank you very much
fprintf(‘Thank you so much’)
Thank you and +10pts for sounding like an older Sheldon from Big Bang Theory