E-mails with feedback/questions about FEX submissions are welcomed. In general I will post e-mails about Answers on the related page, unless there is good cause not to do so.

Answered

How to find last non-NaN element and replace it with NaN?

Loop over the rows, use isnan and use find with the 'last' switch.

How to find last non-NaN element and replace it with NaN?

Loop over the rows, use isnan and use find with the 'last' switch.

circa 6 ore ago | 0

Answered

Load text file into matlab

Without seeing an example of your files, we can't tell you how to tweak the syntax you're using with readtable. Adapting the syn...

Load text file into matlab

Without seeing an example of your files, we can't tell you how to tweak the syntax you're using with readtable. Adapting the syn...

circa 13 ore ago | 0

Answered

coursera MATLAB course, blur image assignment

Using the smart indent is generally a good idea. Now let's go through your code (ignoring the quadruple nested loop that can pro...

coursera MATLAB course, blur image assignment

Using the smart indent is generally a good idea. Now let's go through your code (ignoring the quadruple nested loop that can pro...

circa 16 ore ago | 1

Answered

Plan section of my visual data

https://www.mathworks.com/help/matlab/ref/slice.html [X,Y,Z] = meshgrid(linspace(0,1000,50),linspace(0,1000,50),linspace(-500,...

Plan section of my visual data

https://www.mathworks.com/help/matlab/ref/slice.html [X,Y,Z] = meshgrid(linspace(0,1000,50),linspace(0,1000,50),linspace(-500,...

circa 16 ore ago | 0

Answered

How to run all the external files with same extension .bat within the same folder in MATLAB r2018b

Use dir to create a list of all the bat files. Then you can use either dos or system to run each of them in a for loop.

How to run all the external files with same extension .bat within the same folder in MATLAB r2018b

Use dir to create a list of all the bat files. Then you can use either dos or system to run each of them in a for loop.

2 giorni ago | 0

Answered

I want to include a vertical line on the histogram, so it shows the location of the mean. The mean value is 5.12, how can I modify this code?

You are not plotting a vertical line. The coordinates you're using are (0,y_min) and (5.13,y_max), which is not a vertical line....

I want to include a vertical line on the histogram, so it shows the location of the mean. The mean value is 5.12, how can I modify this code?

You are not plotting a vertical line. The coordinates you're using are (0,y_min) and (5.13,y_max), which is not a vertical line....

2 giorni ago | 1

Answered

format short, format long, format short E, format long E, format rat

For a single value I would suggest the fprintf function: v=1234567.1234567; fprintf('%.7f\n',v)

format short, format long, format short E, format long E, format rat

For a single value I would suggest the fprintf function: v=1234567.1234567; fprintf('%.7f\n',v)

2 giorni ago | 1

| accepted

Answered

Roll a 6-Sided Die and Compute the Probability of the Sum (with bar graph)

The Matlab way would be to use an array. If you read the documentation for randi you will see how you can generate a matrix with...

Roll a 6-Sided Die and Compute the Probability of the Sum (with bar graph)

The Matlab way would be to use an array. If you read the documentation for randi you will see how you can generate a matrix with...

3 giorni ago | 0

Answered

Help! Display Issues

doc disp As for your function: function fee = ParkingFees(t) %One line description of this function goes here % %function d...

Help! Display Issues

doc disp As for your function: function fee = ParkingFees(t) %One line description of this function goes here % %function d...

3 giorni ago | 0

| accepted

Answered

How to check for size of input vector

Start by uncommenting the line with input. Next you need to think how to compare vectors. You can do something complicated, but...

How to check for size of input vector

Start by uncommenting the line with input. Next you need to think how to compare vectors. You can do something complicated, but...

3 giorni ago | 0

Answered

Plotting using a for loop

You are forgetting to index your y variable. In general it is easier to write your code like this in such cases: x = 0: 0.1 : 1...

Plotting using a for loop

You are forgetting to index your y variable. In general it is easier to write your code like this in such cases: x = 0: 0.1 : 1...

4 giorni ago | 0

Answered

I can't write recursive function in Matlab (Please help me)

In case you just want to know how to create a recursive function at all: function n=I_call_myself(n) disp(n) if n>0 n=I_...

I can't write recursive function in Matlab (Please help me)

In case you just want to know how to create a recursive function at all: function n=I_call_myself(n) disp(n) if n>0 n=I_...

6 giorni ago | 0

Answered

Need help making my riddles work

You should use the debugger to go through your code line by line and see what is happening with your variables. You are overwri...

Need help making my riddles work

You should use the debugger to go through your code line by line and see what is happening with your variables. You are overwri...

6 giorni ago | 0

Answered

Anonymous Function soustraction problem with a parameter

You were not actually evaluating the function for values of f; you were entering the anonymous function as a char array. %verif...

Anonymous Function soustraction problem with a parameter

You were not actually evaluating the function for values of f; you were entering the anonymous function as a char array. %verif...

7 giorni ago | 0

| accepted

Answered

Evaluate function over a mesh grid (without for loops)

You have to vectorize the function and split it into two steps: Jfun = @(x,y) (17*x.^2)/2 - 14*x.*y - 40*x + 19*y.^2 - 20*y; u...

Evaluate function over a mesh grid (without for loops)

You have to vectorize the function and split it into two steps: Jfun = @(x,y) (17*x.^2)/2 - 14*x.*y - 40*x + 19*y.^2 - 20*y; u...

7 giorni ago | 0

| accepted

Answered

plot bar with two colors

If you insist on separate bar objects you can use the first part, if not, you can use the second part figure(2),clf(2)%ensure a...

plot bar with two colors

If you insist on separate bar objects you can use the first part, if not, you can use the second part figure(2),clf(2)%ensure a...

8 giorni ago | 0

Answered

Processing txt multiple files in a folder and saving them using the original name but different format

Something like this should work: %replace this: filename = files(i).name; addpath('sorted_csv') dlmwrite(filenam...

Processing txt multiple files in a folder and saving them using the original name but different format

Something like this should work: %replace this: filename = files(i).name; addpath('sorted_csv') dlmwrite(filenam...

8 giorni ago | 0

| accepted

Answered

save an algorithm and call it

Store this in thomas.m function z=thomas(Ac,b,p_minus_2) %solving linear system with Thomas algorithm % % More explanation a...

save an algorithm and call it

Store this in thomas.m function z=thomas(Ac,b,p_minus_2) %solving linear system with Thomas algorithm % % More explanation a...

8 giorni ago | 0

| accepted

Answered

Recursion function in matlab

function n=I_call_myself(n) disp(n) if n>0 n=I_call_myself(n-1); else disp('n has reached 0') end end

Recursion function in matlab

function n=I_call_myself(n) disp(n) if n>0 n=I_call_myself(n-1); else disp('n has reached 0') end end

11 giorni ago | 0

Answered

saving all data from for loop after image processing

You should use the '-append' option if you don't want to overwrite your text file every iteration.

saving all data from for loop after image processing

You should use the '-append' option if you don't want to overwrite your text file every iteration.

11 giorni ago | 0

| accepted

Answered

Splitting an array up

You can modify the row indices you feed to mat2cell: data=rand(64,92690);%generate random data div=2048; c=div*ones(1,ceil(...

Splitting an array up

You can modify the row indices you feed to mat2cell: data=rand(64,92690);%generate random data div=2048; c=div*ones(1,ceil(...

11 giorni ago | 1

Answered

Ternary plot in MATLAB

The TrianglePlot function I posted on the FEX seems to work just fine (although I decreased the number of points for this exampl...

Ternary plot in MATLAB

The TrianglePlot function I posted on the FEX seems to work just fine (although I decreased the number of points for this exampl...

11 giorni ago | 0

Answered

Plot data for unique temperatures imported from text file

%% code starts here r_data = importdata('reactions.txt'); %reaction_data = r_data.data; %fid=fopen('reactions.txt'); t = rea...

Plot data for unique temperatures imported from text file

%% code starts here r_data = importdata('reactions.txt'); %reaction_data = r_data.data; %fid=fopen('reactions.txt'); t = rea...

11 giorni ago | 2

| accepted

Answered

Pair of dice always rolled until all results happened between (2-12) ..Expected value of throws to find

Since this is homework I won't give a complete solution, but I will give hints. If you have trouble implementing these, feel fre...

Pair of dice always rolled until all results happened between (2-12) ..Expected value of throws to find

Since this is homework I won't give a complete solution, but I will give hints. If you have trouble implementing these, feel fre...

11 giorni ago | 0

Answered

How can i extract the value of an element of a sparse double?

You can convert the result to a full matrix. Indexing only extracts part of the array, but doesn't influence the sparse property...

How can i extract the value of an element of a sparse double?

You can convert the result to a full matrix. Indexing only extracts part of the array, but doesn't influence the sparse property...

12 giorni ago | 1

Answered

How do you average each pixel in an image with a 9x9 square?

If you want the average (or something like a gaussian blur): use conv2, as described in the answer you linked. Read the document...

How do you average each pixel in an image with a 9x9 square?

If you want the average (or something like a gaussian blur): use conv2, as described in the answer you linked. Read the document...

12 giorni ago | 0

| accepted

Answered

Running same program is giving different plot

Clear all should only exist exactly once in your entire code base. Replace it with clear or clearvars. If you want to have re...

Running same program is giving different plot

Clear all should only exist exactly once in your entire code base. Replace it with clear or clearvars. If you want to have re...

13 giorni ago | 0

| accepted

Answered

Reshaping a Char Array

This should do it: A = ['12';'12';'12';'12';'12';'12';'12';'12';'34';'34';'34';'34';'34';'34';'34';'34';'56';'56';'56';'56';'56...

Reshaping a Char Array

This should do it: A = ['12';'12';'12';'12';'12';'12';'12';'12';'34';'34';'34';'34';'34';'34';'34';'34';'56';'56';'56';'56';'56...

14 giorni ago | 1

| accepted

Answered

How to draw a inscribed circle having maximum radius inside the binary image. I have already identified the centroid of the object.

If you invert your image, you can use bwdist to find the point furthest from the edge. That distance is by default the radius of...

How to draw a inscribed circle having maximum radius inside the binary image. I have already identified the centroid of the object.

If you invert your image, you can use bwdist to find the point furthest from the edge. That distance is by default the radius of...

14 giorni ago | 0