Postdoctoral research associate at Illinois State Water Survey. Using MATLAB for past 10 years.

Answered

Plotting a contour plot with excel data

doc readmatrix Import your data into a 2D array and then decide what columns you want to plot using contourf

Plotting a contour plot with excel data

doc readmatrix Import your data into a 2D array and then decide what columns you want to plot using contourf

etwa ein Monat ago | 0

| accepted

Answered

Save multiple .dat files using for loop

Try this: fileName = sprintf('test%d.dat',k); writematrix(your_matrix,fileName);

Save multiple .dat files using for loop

Try this: fileName = sprintf('test%d.dat',k); writematrix(your_matrix,fileName);

etwa ein Monat ago | 0

Answered

xlswrite writing extra collumns

"e.g. columns of data from searchresult2 for filename15 get added into, and written into filename16" That's because you dont ha...

xlswrite writing extra collumns

"e.g. columns of data from searchresult2 for filename15 get added into, and written into filename16" That's because you dont ha...

etwa ein Monat ago | 0

Answered

Writing every output of a loop to an Excel table

Two approaches for this: Option 1: You can write the table at the end of all iterations if you want to create a single excel f...

Writing every output of a loop to an Excel table

Two approaches for this: Option 1: You can write the table at the end of all iterations if you want to create a single excel f...

etwa ein Monat ago | 1

| accepted

Answered

How can I join two parts of a char into just one?

Try this: fileID = 1; for i = 1:9 for j = 6:0.5:10 fileName{fileID,1} = strcat('SiON_D4_L',num2str(j),'_12Lyrs_T...

How can I join two parts of a char into just one?

Try this: fileID = 1; for i = 1:9 for j = 6:0.5:10 fileName{fileID,1} = strcat('SiON_D4_L',num2str(j),'_12Lyrs_T...

etwa ein Monat ago | 0

| accepted

Answered

Finding min values of third column for rows with similar values

If the order is not important, look at sort function.

Finding min values of third column for rows with similar values

If the order is not important, look at sort function.

etwa 2 Monate ago | 0

Answered

Accessing Elements in a 3D matrix using Linear Indexing ?

Yes, it is possible. Read this. A = rand(10,10,10); B = A(1:2,1:2,1:2); %<- indexing the first two values in all dimensions s...

Accessing Elements in a 3D matrix using Linear Indexing ?

Yes, it is possible. Read this. A = rand(10,10,10); B = A(1:2,1:2,1:2); %<- indexing the first two values in all dimensions s...

etwa 2 Monate ago | 0

Answered

I dont know where im going wrong with the code

The left-hand side should be the variable alone. Change that to c = sqrt(adj^2 + opp^2) c^2 cannot be the variable name as it...

I dont know where im going wrong with the code

The left-hand side should be the variable alone. Change that to c = sqrt(adj^2 + opp^2) c^2 cannot be the variable name as it...

etwa 2 Monate ago | 0

| accepted

Answered

Error using Video Writer

Your code looks strange. Do you have 'hold on' before the loop? Also if you have complete extents of your x,y variables, you c...

Error using Video Writer

Your code looks strange. Do you have 'hold on' before the loop? Also if you have complete extents of your x,y variables, you c...

etwa 2 Monate ago | 0

Answered

Subplot VAR variables in one figure

I just tried your code with a dummy matrix, values and see no error regarding linestyle. It would help if you can attach your ma...

Subplot VAR variables in one figure

I just tried your code with a dummy matrix, values and see no error regarding linestyle. It would help if you can attach your ma...

etwa 2 Monate ago | 0

Answered

I want to plot a graph like this in Matlab. It would be a great help if someone can help me with the same by providing the code.

Neglecting i=0, you will have 7 lines governed by that equation. Have you tried it by using a simple loop for i = 1:7 ? x = ...

I want to plot a graph like this in Matlab. It would be a great help if someone can help me with the same by providing the code.

Neglecting i=0, you will have 7 lines governed by that equation. Have you tried it by using a simple loop for i = 1:7 ? x = ...

etwa 2 Monate ago | 0

Answered

Convert .mat file into .xls file

https://www.mathworks.com/help/matlab/import_export/exporting-to-excel-spreadsheets.html Follow the example given on that page....

Convert .mat file into .xls file

https://www.mathworks.com/help/matlab/import_export/exporting-to-excel-spreadsheets.html Follow the example given on that page....

etwa 2 Monate ago | 0

Answered

Index exceeds the number of array elements (4)

Try debugging by placing breakpoints inside the functions. Here is what I see. Your q_level array is size 1x4 while the q_inde...

Index exceeds the number of array elements (4)

Try debugging by placing breakpoints inside the functions. Here is what I see. Your q_level array is size 1x4 while the q_inde...

etwa 2 Monate ago | 0

Answered

How to save the axes include x-axis and y-axis

Try this, after your axis() line: ax=gca; ax.XTick = 0:0.2:1; ax.XTickLabel = 0:0.2:1; ax.YTick = 0:0.2:1; ax.YTickLabel = ...

How to save the axes include x-axis and y-axis

Try this, after your axis() line: ax=gca; ax.XTick = 0:0.2:1; ax.XTickLabel = 0:0.2:1; ax.YTick = 0:0.2:1; ax.YTickLabel = ...

etwa 2 Monate ago | 0

Answered

scatter plot with showing their means and error bars

doc errorbar Look at the matlab example: "plot error bars with no line".

scatter plot with showing their means and error bars

doc errorbar Look at the matlab example: "plot error bars with no line".

etwa 2 Monate ago | 0

Answered

How to make a a certain range with different color in colorbar

Try this function: https://www.mathworks.com/matlabcentral/fileexchange/4058-bluewhitered

How to make a a certain range with different color in colorbar

Try this function: https://www.mathworks.com/matlabcentral/fileexchange/4058-bluewhitered

etwa 2 Monate ago | 0

| accepted

Answered

Plot 9 parameters for 29 country for 20 years in one curve

You can try something like this: % Read data from one sheet data = readtable('base.xlsx','Sheet','Feuil6'); % Read a param...

Plot 9 parameters for 29 country for 20 years in one curve

You can try something like this: % Read data from one sheet data = readtable('base.xlsx','Sheet','Feuil6'); % Read a param...

etwa 2 Monate ago | 0

| accepted

Answered

Split array into training and testing based on label ?

Try this: A = rand(500,4); labels = randi([1,4],500,1); A(:,4) = labels; % Filter data based on labels A_1 = A(A(:,4...

Split array into training and testing based on label ?

Try this: A = rand(500,4); labels = randi([1,4],500,1); A(:,4) = labels; % Filter data based on labels A_1 = A(A(:,4...

etwa 2 Monate ago | 0

| accepted

Answered

constructing a video from a sequence images

It depends on the order in which you are reading the image files. If you want to check this, look at your imageNames variable an...

constructing a video from a sequence images

It depends on the order in which you are reading the image files. If you want to check this, look at your imageNames variable an...

etwa 2 Monate ago | 0

Answered

Trying to save the red positions of an image

Does your image has that Red value? Double-check it. To test your code, follow this example. A = imread('ngc6543a.jpg')...

Trying to save the red positions of an image

Does your image has that Red value? Double-check it. To test your code, follow this example. A = imread('ngc6543a.jpg')...

etwa 2 Monate ago | 1

Answered

How to repeat different vectors to form another vector?

For OPs example, it would be: >> A = [repmat([1,2,3],1,3) repmat([4,5,6],1,3)] %... repmat([k-2,k,k],1,3)]; >> A = 1 ...

How to repeat different vectors to form another vector?

For OPs example, it would be: >> A = [repmat([1,2,3],1,3) repmat([4,5,6],1,3)] %... repmat([k-2,k,k],1,3)]; >> A = 1 ...

etwa 2 Monate ago | 0

Answered

How to prevent decrement (melting) past 0 until growth increases again?

As soon as you estimated hsnow, force all/any negative values to 0 hsnow(hsnow<0)=0;

How to prevent decrement (melting) past 0 until growth increases again?

As soon as you estimated hsnow, force all/any negative values to 0 hsnow(hsnow<0)=0;

etwa 2 Monate ago | 0

Answered

Plotting Velocity potential and streamline

This is a boundary value problem. You need to have the initial and boundary conditions to develop the velocity field required fo...

Plotting Velocity potential and streamline

This is a boundary value problem. You need to have the initial and boundary conditions to develop the velocity field required fo...

etwa 2 Monate ago | 0

Answered

How to make binary file for each iteration in a loop?

I think, instead of the code creating "only the last file", it is overwritting the same file, so you end up with only one file. ...

How to make binary file for each iteration in a loop?

I think, instead of the code creating "only the last file", it is overwritting the same file, so you end up with only one file. ...

etwa 2 Monate ago | 0

Answered

Plotting the average line of a graph of a column imported from an excel

Not sure, where you are getting the error. I tried this % some random numbers x=rand(15808,1); % get the average by usi...

Plotting the average line of a graph of a column imported from an excel

Not sure, where you are getting the error. I tried this % some random numbers x=rand(15808,1); % get the average by usi...

etwa 2 Monate ago | 1

| accepted

Answered

Calculate volume of cylindric tank

Try this: function [tank_volume mA_points fuel_level mA_reading] = get_tank_volume(tank_diameter, tank_length, sensor_read) % ...

Calculate volume of cylindric tank

Try this: function [tank_volume mA_points fuel_level mA_reading] = get_tank_volume(tank_diameter, tank_length, sensor_read) % ...

etwa 2 Monate ago | 0

| accepted

Answered

Location of the "end" statement of the main function in a m. file?

If you have 'end' at the end of a file, then your functions become 'Nested functions'. The variables created inside the function...

Location of the "end" statement of the main function in a m. file?

If you have 'end' at the end of a file, then your functions become 'Nested functions'. The variables created inside the function...

etwa 2 Monate ago | 1

Solved

Who Has the Most Change?

You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

etwa 2 Monate ago

Solved

Free passes for everyone!

_Simply return the name of the coolest numerical computation software ever_ *Extra reward* (get a _freepass_): Once a mont...

etwa 2 Monate ago

Solved

Area of an equilateral triangle

Calculate the area of an equilateral triangle of side x. <<https://i.imgur.com/jlZDHhq.png>> Image courtesy of <http://up...

etwa 2 Monate ago