Answered

Copy the same rows from multiple identical files to a single file

Sicne you have not attached any sample file, I am using a file having 5 rows, and extracting 2nd and 5th rows from these. Attach...

Copy the same rows from multiple identical files to a single file

Sicne you have not attached any sample file, I am using a file having 5 rows, and extracting 2nd and 5th rows from these. Attach...

9 mesi ago | 1

| accepted

Answered

Subtract a different number from every group n of values in a table

You can use reshape to perform operations: data=randi(20,1,1728000); B=reshape(data,36000,[]); B=B-ones(size(B,1),size(B,2))....

Subtract a different number from every group n of values in a table

You can use reshape to perform operations: data=randi(20,1,1728000); B=reshape(data,36000,[]); B=B-ones(size(B,1),size(B,2))....

9 mesi ago | 0

Answered

How to plot a tiled layout using a loop?

for r = 1:10 subplot(2,5,r) plot(randi(10,5,5),'ro') end If you have two loops, you can use as follows: for r = 1...

How to plot a tiled layout using a loop?

for r = 1:10 subplot(2,5,r) plot(randi(10,5,5),'ro') end If you have two loops, you can use as follows: for r = 1...

9 mesi ago | 1

| accepted

Answered

matrix inverse, swap columns and rows

This looks like a homework problem. Here are some hints you can use it: A = randi([-10,10],5,10) %for swapping rows A([1 2]...

matrix inverse, swap columns and rows

This looks like a homework problem. Here are some hints you can use it: A = randi([-10,10],5,10) %for swapping rows A([1 2]...

9 mesi ago | 0

| accepted

Answered

Is it possible to reduce the alpha for markers in a simple plot?

Plot function doesn't have support to tune transparency. You can use scatter to do that scat = scatter(x,y,'MarkerFaceColor','b...

Is it possible to reduce the alpha for markers in a simple plot?

Plot function doesn't have support to tune transparency. You can use scatter to do that scat = scatter(x,y,'MarkerFaceColor','b...

9 mesi ago | 0

| accepted

Answered

Find element satisfying condition in 3D array, then apply operation to all elements in the column number

" I want to find all the elements that satisfy a certain condition in A (e.g. A<0). ": I hope you mean to find the indices of th...

Find element satisfying condition in 3D array, then apply operation to all elements in the column number

" I want to find all the elements that satisfy a certain condition in A (e.g. A<0). ": I hope you mean to find the indices of th...

9 mesi ago | 1

| accepted

Answered

How can I concatenate a row vertically every 5 cells?

You can use reshape command to do that. A=randi(20,1,100); reshape(A,20,5); reshape(A,20,5); It reshapes along the column of...

How can I concatenate a row vertically every 5 cells?

You can use reshape command to do that. A=randi(20,1,100); reshape(A,20,5); reshape(A,20,5); It reshapes along the column of...

9 mesi ago | 0

| accepted

Answered

Generate a plot set

for kk=1:65 f=figure plot(randi(10,5,5)) print(sprintf('figure_%d',kk),'-djpeg','-r100') close(f) end

Generate a plot set

for kk=1:65 f=figure plot(randi(10,5,5)) print(sprintf('figure_%d',kk),'-djpeg','-r100') close(f) end

9 mesi ago | 0

Answered

Optimization problem for trigonometric functions

If k, lo, r1, and r2 are constants, you can use anonymous function to calculate the expression: k=randi(10,1,1); lo=randi(10...

Optimization problem for trigonometric functions

If k, lo, r1, and r2 are constants, you can use anonymous function to calculate the expression: k=randi(10,1,1); lo=randi(10...

9 mesi ago | 0

Answered

find the smallest value of the surface area A in the vector A and the corresponding values of x and y in the vectors x and y.

You can simply use boolean function to find the location of minimum surface area, and subsquently use the same index to get the ...

find the smallest value of the surface area A in the vector A and the corresponding values of x and y in the vectors x and y.

You can simply use boolean function to find the location of minimum surface area, and subsquently use the same index to get the ...

9 mesi ago | 0

Answered

How to plot a horizontal line between two arrays?

Question is not clear. Quoting on a part of your question, " flat line for A(1)=5 at a Y of 1 extended to B(1)=10 at the same Y"...

How to plot a horizontal line between two arrays?

Question is not clear. Quoting on a part of your question, " flat line for A(1)=5 at a Y of 1 extended to B(1)=10 at the same Y"...

9 mesi ago | 0

| accepted

Answered

Getting a number of different outputs using a single function

I have changed just the index where you are saving the output. Focussing on "And if I have n=2, then I should have ExDataout(...

Getting a number of different outputs using a single function

I have changed just the index where you are saving the output. Focussing on "And if I have n=2, then I should have ExDataout(...

9 mesi ago | 0

Answered

Continuous execution of vertical line for set of data

"I want to plot a vertical line at each of these values. ". The array you provided is 1D array. You will get 1 line plot out of ...

Continuous execution of vertical line for set of data

"I want to plot a vertical line at each of these values. ". The array you provided is 1D array. You will get 1 line plot out of ...

9 mesi ago | 0

| accepted

Answered

How to search through Data in a Matrix to find a specific element using For Loops and if statements?

Why do you wish to use for and if for searching the locations of SE? You can use without using for and if, and it would be very ...

How to search through Data in a Matrix to find a specific element using For Loops and if statements?

Why do you wish to use for and if for searching the locations of SE? You can use without using for and if, and it would be very ...

9 mesi ago | 0

| accepted

Answered

Selective columns from multiple text folders

Since you have not attached a text file, I just put a sample text file having multiple rows in multiple folders, and use the be...

Selective columns from multiple text folders

Since you have not attached a text file, I just put a sample text file having multiple rows in multiple folders, and use the be...

9 mesi ago | 0

Answered

Merge columns and export to a text file

Focusing on "I need to convert it to the .txt (MS-DOS) in this form:" in your question, this chunck of code might help you. AB ...

Merge columns and export to a text file

Focusing on "I need to convert it to the .txt (MS-DOS) in this form:" in your question, this chunck of code might help you. AB ...

9 mesi ago | 1

| accepted

Answered

Multiple inputs/outputs of a function

You can use the same function which you provided, and use loop while calling the function, or you can modify the function to giv...

Multiple inputs/outputs of a function

You can use the same function which you provided, and use loop while calling the function, or you can modify the function to giv...

9 mesi ago | 0

| accepted

Answered

Error using plot Invalid data argument (Data from Excel)

You can generate dates as per the values in the excel sheet. This won't throw an error for dimension mismatch. [~, ~, weather_d...

Error using plot Invalid data argument (Data from Excel)

You can generate dates as per the values in the excel sheet. This won't throw an error for dimension mismatch. [~, ~, weather_d...

9 mesi ago | 0

| accepted

Answered

Deleting specific rows in a matrix

A=[120 150 200 250 300 350 420 450 0 0 100 400 450 0 420] index=find(nanmean(A==0,2...

Deleting specific rows in a matrix

A=[120 150 200 250 300 350 420 450 0 0 100 400 450 0 420] index=find(nanmean(A==0,2...

9 mesi ago | 0

| accepted

Answered

When i covert a structure to cell array, my fieldNames disappear

"Is there a way to have both field and values on the cell array?" Let us create a sample structure S.x = linspace(0,4*pi); S....

When i covert a structure to cell array, my fieldNames disappear

"Is there a way to have both field and values on the cell array?" Let us create a sample structure S.x = linspace(0,4*pi); S....

9 mesi ago | 0

Answered

How to plot an average of two netcdf variables from different files?

If you have multiple netcdf files in a folder, and wish to take mean of SST, you can have a for loop to read the values, and sub...

How to plot an average of two netcdf variables from different files?

If you have multiple netcdf files in a folder, and wish to take mean of SST, you can have a for loop to read the values, and sub...

9 mesi ago | 0

| accepted

Answered

Does cell2mat work in Matlab 2019?

It is working well for me. C = {[1], [2 3 4]; [5; 9], [6 7 8; 10 11 12]} A = cell2mat(C) 1 2 3 4 ...

Does cell2mat work in Matlab 2019?

It is working well for me. C = {[1], [2 3 4]; [5; 9], [6 7 8; 10 11 12]} A = cell2mat(C) 1 2 3 4 ...

9 mesi ago | 0

Answered

Trying to add color gradient to patch(isosurface))

Not sure about the exact what you wish to plot. But you can give it a try to plot using imagesc, use the gray colormap to plot. ...

Trying to add color gradient to patch(isosurface))

Not sure about the exact what you wish to plot. But you can give it a try to plot using imagesc, use the gray colormap to plot. ...

9 mesi ago | 0

Answered

Predetermine axis limits without plotting

You can give it a try to add small value to the maximum value of the array. It can either be 10% or 20% of the extreme. x_vals...

Predetermine axis limits without plotting

You can give it a try to add small value to the maximum value of the array. It can either be 10% or 20% of the extreme. x_vals...

9 mesi ago | 0

Answered

how to find derivative of a function and ploting the surface of function and its derivative

In order to plot a surface, you can use the below commands: [X,Y] = meshgrid(1:0.5:10,1:20); Z = sin(X) + cos(Y); surf(X,Y,Z)...

how to find derivative of a function and ploting the surface of function and its derivative

In order to plot a surface, you can use the below commands: [X,Y] = meshgrid(1:0.5:10,1:20); Z = sin(X) + cos(Y); surf(X,Y,Z)...

9 mesi ago | 1

Answered

Changing input data sample from the same dataset

SInce you have not attached sample data, that is why I am generating some random dataset like yours. dataset=randi(5,23,6); dat...

Changing input data sample from the same dataset

SInce you have not attached sample data, that is why I am generating some random dataset like yours. dataset=randi(5,23,6); dat...

9 mesi ago | 0

| accepted

Answered

Onramp problem 14.1 and 14.2 plotting problems

Few points I need to mention: 1) You are calculating R1_av as a function of u, so if you use the below chunk of code, it will p...

Onramp problem 14.1 and 14.2 plotting problems

Few points I need to mention: 1) You are calculating R1_av as a function of u, so if you use the below chunk of code, it will p...

9 mesi ago | 2

Answered

How to change datenum to normal date format?

You can use this function from the matlab file exchange to read time from a ncetcf file in user specified format: https://in.ma...

How to change datenum to normal date format?

You can use this function from the matlab file exchange to read time from a ncetcf file in user specified format: https://in.ma...

9 mesi ago | 0

Answered

For loop for hilb matrix

for i = 5:5:40 output_mat=hilb(i); % if you wish to store in cell array, uncomment the below line output_mat_cell{i...

For loop for hilb matrix

for i = 5:5:40 output_mat=hilb(i); % if you wish to store in cell array, uncomment the below line output_mat_cell{i...

9 mesi ago | 0

Answered

How to create nc file having lat, long, time, and 2D matrix

I hope this helps. [data]=xlsread('test.csv'); lat=data(2,2:end); lon=data(1,2:end); vardata=data(3:end,2:end); vardata(:,s...

How to create nc file having lat, long, time, and 2D matrix

I hope this helps. [data]=xlsread('test.csv'); lat=data(2,2:end); lon=data(1,2:end); vardata=data(3:end,2:end); vardata(:,s...

oltre 2 anni ago | 0