plot of markers, having different color in one line of code.
x2=[1,3]; y2=[3,4]; x3=[3,4,5]; y3=[1,6,7]; cell_values={x2,y2;x3,y3}; col_vals={[0.500 0.3250 0.0500],[0.8500 0.3250 0.0...

3年以上 前 | 0

| 採用済み

How to evaluate an algebraic expression at a certain point when it is in a matrix?
You can use matlabFunction to create an anonymous function, which will eventually help to calcuate the values at specific x1 and...

3年以上 前 | 1

| 採用済み

How to open a cell array??
out=zeros(length(result_pettitt),max(cellfun(@(x) length(x), result_pettitt))); for kk=1:length(result_pettitt) out(kk,1:l...

3年以上 前 | 1

| 採用済み

Deleting the same empty row in 2 different column vectors - then searching a value giving the other column vector result

3年以上 前 | 0

| 採用済み

Colorbar font size decreases upon export
Instead of manually saving the figure, you can prefer to save figure by command. It won't shrink the figure. print('sample','-d...

3年以上 前 | 0

| 採用済み

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...

3年以上 前 | 1

| 採用済み

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))....

3年以上 前 | 0

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...

3年以上 前 | 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]...

3年以上 前 | 0

| 採用済み

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...

3年以上 前 | 0

| 採用済み

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...

3年以上 前 | 1

| 採用済み

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...

3年以上 前 | 0

| 採用済み

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

3年以上 前 | 0

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...

3年以上 前 | 0

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 ...

3年以上 前 | 0

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"...

3年以上 前 | 0

| 採用済み

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(...

3年以上 前 | 0

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 ...

3年以上 前 | 0

| 採用済み

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 ...

3年以上 前 | 0

| 採用済み

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...

3年以上 前 | 0

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 ...

3年以上 前 | 1

| 採用済み

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...

3年以上 前 | 0

| 採用済み

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...

3年以上 前 | 0

| 採用済み

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...

3年以上 前 | 0

| 採用済み

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....

3年以上 前 | 0

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...

3年以上 前 | 1

| 採用済み

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 ...

3年以上 前 | 0

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. ...

3年以上 前 | 0

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...

3年以上 前 | 0

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)...

3年以上 前 | 1