Answered
Convert ASCII file numbers to a date/duration
% creating a numeric column vector like your time values: t = (500*(0:11).'+10000*(0:23)); t = t(:); t(1) = []; % no midnight...

4 years ago | 1

| accepted

Answered
How to create a 3D-surface plot from potential energy surface data from Gaussview?
The third argument (Z) to surf() has to be a matrix. (The first and second arguments (X and Y) can be matrices of the same size ...

4 years ago | 0

| accepted

Answered
How to select rows of matrix based on other matrix column?
nodes = [1 2 4 6 9 11]; arcs = [1 2 0 1 4 1 3 9 8 7 2 1 8...

4 years ago | 0

Answered
Retaining the length of matrix after difference
A1 = [2 4 5 6 7 8 9 10 11 3 ]; A2 = [ 2 7 10]; A3 = A1; A3(ismember(A1,A2)) = 0

4 years ago | 0

Answered
Matrix Issue Line 33, 35, 37
Use element-wise division (./) in the calculations on those lines, and use element-wise multiplication (.*) in the subsequent ca...

4 years ago | 1

| accepted

Answered
How to reproduce a figure?
f = figure(); ax = axes( ... 'Parent',f, ... 'NextPlot','add'); % grey shading on top: p = patch( ... 'Parent'...

4 years ago | 1

| accepted

Answered
How to use cellfun?
You can make that code into its own function and then use cellfun() to call that function on all pairs of tables: load('Data1.m...

4 years ago | 1

| accepted

Answered
Can this be written in a easier way?
See my answer below, which was for your similar previous question, which has since been deleted. I realize this new question is...

4 years ago | 1

| accepted

Answered
How can i add elements of the row at the end of the row?
A = [1 2 3 4]; A = repmat(A,1,36)

4 years ago | 0

| accepted

Answered
Plot using radio buttons overwritten instead of substituted
You need some way to delete old plots whose corresponding radiobutton was selected at some point but now is no longer selected. ...

4 years ago | 0

| accepted

Answered
randomly shuffle the matrix by taking two rows
A = [1 5 9 13 17 20 2 6 10 14 18 21 3 7 11 15 19 22 4 ...

4 years ago | 0

| accepted

Answered
Write 2d matrix to single Excel cell
load('Nm.mat'); load('Val.mat'); t = table(Nm,Val); % make a cell array containing the table's contents C = table2cell(t); ...

4 years ago | 1

| accepted

Answered
How to scan a matrix row by row and execute certain commands if conditions are met.
A = [12 0 0 0 0 0 0 13 0 0 0 0 0 0 0 0 0 11]; % sca...

4 years ago | 0

| accepted

Answered
How to combine hundreds of CSV files in Matlab?
Here's an example of how to do it (with 2 files): input_path = '.'; % location of .csv files output_file = 'result.csv'; % nam...

4 years ago | 3

| accepted

Answered
Extracting single numbers from each cell in a cell array
% first, create a cell array like yours: C = cell(451,1); for ii = 1:numel(C) C{ii} = randn(57,41); end % look at the f...

4 years ago | 1

| accepted

Answered
plot legend and axis does not display, also i need to assign numbers to each of the points such as PU(1 to 20) and SU(1 TO 20)
Avoid having extra spaces in character vectors. MATLAB treats ' Interpreter ' differently than it treats 'Interpreter' I re...

4 years ago | 0

| accepted

Answered
Error: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
I think that line should be like this: intensitas = (1-a)*((1-b)*F(p,q) + ... b * F(p, q+1)) + ... a *((1-b)* F(p+1, q) + ......

4 years ago | 0

| accepted

Answered
How to save the last four iterations in a for-loop
Here's one way: clear ; clc b = 2 ; for i = 1:100 if i > 96 a(i-96) = b + 4 ; end ...

4 years ago | 1

Answered
Why am I getting the error "Brace indexing is not supported for variables of this type" when using cell of doubles?
Try removing cell2mat() in the second case: for p = 1:length(file_list) for c = 1:1 ...

4 years ago | 0

| accepted

Answered
Rearrange a given array
% A = [1 2 3 4 % 5 6 7 8 % 9 10 11 12] % A = A.'; % A = reshape(A(end:-1:1),3,[])...

4 years ago | 0

| accepted

Answered
Trend line for a section of a data set but it keeps giving me a weird result
What if you change this: Re_fit = polyval (p,Cdlbf); plot (Re,Cd,'*',Re_fit,Cdlbf,'-'); to this: Re_fit = polyval(p,Relbf)...

4 years ago | 1

Answered
Saving input from a textarea to a workspace variable
'textEntered' is not recognized because it is specified as the 'ValueChangedFcn' of textarea here: textarea = uitextarea(fig,.....

4 years ago | 0

Answered
I want to subtract 2 image A and B, where both have different dimension. size of A ( 400,400,3) and size of B (398,398,3). how to do it?
You'll have to make them the same size before you can subtract them. There are different ways you might do that, but in this ca...

4 years ago | 1

Answered
Sum matrix with repeating indices
One perfectly valid MATLAB approach: A = [1 2 1 -3 2 0 3 3 5 6 2 -4 4 0.5 7 9 ...

4 years ago | 0

Answered
Plot X, Y, Z axes with respect to time
% making up some data: t = 0:0.01:10; x = cos(t); y = sin(t); z = t; % plot x,y,z vs t in one plot: figure(); plot(t,x,...

4 years ago | 0

| accepted

Answered
How to export fitted y value in the graph
Thank you for sharing the code. Looking at PPEReactionNetworkToolNMR.m, I see the plotting part: plot(tspan, A_raw','r*') plot...

4 years ago | 0

| accepted

Answered
How to plot histogram of each column of table and compare against the column of another table using for loop?
It's not clear exactly what you mean by "depicting the comparison". Should it be two histograms per table column, one histogram ...

4 years ago | 0

| accepted

Answered
Several regressions with loop and storing the output data
The fifth output from regress() (i.e., stats) is a 1-by-4 vector each time you run regress(). You can collect that output each ...

4 years ago | 0

| accepted

Answered
I am working on kaprekars constant homework, and everytime I write a while loop I get error.
See below: % ask for the input number only once at the beginning: a=input('enter number a: '); b=input('enter number b: '); ...

4 years ago | 0

| accepted

Answered
Matrix calculation without Loop
Try this instead of that loop: A(i+1:n,i) = (1/A(i,i))*(A(i+1:n,i)-sum(A(i+1:n,1:i-1).*A(i,1:i-1),2)); To test it: % using th...

4 years ago | 1

| accepted

Load more