Comments on: Top 10 MATLAB code practices that make me cry https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/?s_tid=feedtopost Stuart uses video to share his experiences solving problems with MATLAB day-to-day, interesting new features, plus tips and tricks he has picked up along the way. Wed, 14 Nov 2018 16:42:49 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Charis https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-86548 Wed, 14 Nov 2018 16:42:49 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-86548 Nicely put, Thanks!

http://ebookee.org/user/dietiora71

]]>
By: Ankit Saxena https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-85141 Fri, 12 Oct 2018 08:12:49 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-85141 What a fantastic read on Python. This has helped me understand a lot in Python course. Please keep sharing similar write ups on Python. Guys if you are keen to know more on Python, must check this wonderful Python tutorial and i’m sure you will enjoy learning on Python training.:-https://www.youtube.com/watch?v=HcsvDObzW2U

]]>
By: RaplhCramden https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-82642 Thu, 07 Jun 2018 16:45:21 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-82642 I personally hate scripts that start with
clear all;
close all;
fclose all;

]]>
By: RaplhCramden https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-82640 Thu, 07 Jun 2018 16:43:21 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-82640 I personally hate scripts that start with

]]>
By: zeynabbb https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-77130 Fri, 27 Oct 2017 11:16:22 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-77130 Hi
Why can not I increase the scopecard entry in MATLAB 2014?

]]>
By: Stuart McGarrity https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-76842 Thu, 20 Jul 2017 21:40:16 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-76842 In reply to Laurence Lurio.

Hi Laurence, Have you tried defining g(x) as a nested function? i.e.

function func=makeG
Z=2;
Y=3;
func=@g;
function result=g(x)
result=x+Y+Z;
end
end

Nested functions can access the variables in the parent.

]]>
By: Laurence Lurio https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-76797 Mon, 10 Jul 2017 22:26:33 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-76797 Regarding the question of globals, the instance where I haven’t found a good alternative is when I want to integrate in one dimension over a function that exists in multiple dimensions. Suppose I want to integrate f(x,y,z) from x=x1, to x=x2 with y fixed at Y and z fixed at Z. If I use a canned integration routine it wants me to input a function of one variable, g(x). I can avoid this problem if I define Y and Z to be global and then define g(x) as f(x,Y,Z) with one input and two globals. Is there a better way to do this?

]]>
By: Stuart McGarrity https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-76050 Wed, 17 May 2017 00:37:36 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-76050 Hi Victor, “Scoping of variables” means limiting or controlling the region of a program in which they are defined (exist). It is best to narrow the scope of variables as much as possible, to limit unintended side effects.

]]>
By: Victor de Castro Morini https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-76046 Tue, 16 May 2017 21:33:19 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-76046 Hello,

I have a doubt.

What do you mean by “scoping of variables” ?

Many thanks!

]]>
By: Alex https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-61500 Thu, 28 Apr 2016 02:31:27 +0000 https://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me-cry/#comment-61500 @Beth,

Try re-arranging deep_mean and shallow_mean into matrices:
dm = reshape(deep_mean,12,[]); % Tells reshape to have each row as a month and determine the number of columns automatically.

dm_summer would then be nanmean(dm(6:8,:)); %This tells matlab to pull out rows 6, 7, and 8 (all columns) and compute the mean from there.

]]>