Answered

Meaning of "Intlinprog stopping at the root node"

It is a term defined in the LP algorithms. Rood node is the relaxed LP problem. It is difficult to describe everything in this a...

Meaning of "Intlinprog stopping at the root node"

It is a term defined in the LP algorithms. Rood node is the relaxed LP problem. It is difficult to describe everything in this a...

34 minutes ago | 0

Answered

How to put legend outside the chart?

The Position property of ax2 gets changed later when you resize the figure window. It is better to use linkprop(). Change the li...

How to put legend outside the chart?

The Position property of ax2 gets changed later when you resize the figure window. It is better to use linkprop(). Change the li...

1 hour ago | 0

| accepted

Answered

Variable for table are in one row and not one column. How do I turn it or save a variable in one column?

You can use the transpose operator data = (1:number).'; or indexing data = 1:number; data = data(:) or reshape() data = re...

Variable for table are in one row and not one column. How do I turn it or save a variable in one column?

You can use the transpose operator data = (1:number).'; or indexing data = 1:number; data = data(:) or reshape() data = re...

2 hours ago | 1

| accepted

Answered

Error in mergint .txt files

You are probably creating the filename incorrectly in the line filename = ['Fin',num2str(i),'.txt'];%filename Try the followin...

Error in mergint .txt files

You are probably creating the filename incorrectly in the line filename = ['Fin',num2str(i),'.txt'];%filename Try the followin...

2 hours ago | 0

Answered

Extracting particular rows and column from bunch of excel files and saving into one file

files(ii) is a struct. You need to access the name property data = csvread(fullfile(files(ii).folder,files(ii).name)) Also, on...

Extracting particular rows and column from bunch of excel files and saving into one file

files(ii) is a struct. You need to access the name property data = csvread(fullfile(files(ii).folder,files(ii).name)) Also, on...

2 hours ago | 0

Answered

how to solve a system of equations in matlab

An alternate from symbolic toolbox syms x F = piecewise(x<=0, x+2, x>0, -x+2); fplot(F, [-2 2])

how to solve a system of equations in matlab

An alternate from symbolic toolbox syms x F = piecewise(x<=0, x+2, x>0, -x+2); fplot(F, [-2 2])

4 hours ago | 0

Answered

How I can extract an object entry from an index of cell array?

Use the curly brackets to access the content inside the cell arrays tempCell{1,1}.dist = 100;

How I can extract an object entry from an index of cell array?

Use the curly brackets to access the content inside the cell arrays tempCell{1,1}.dist = 100;

4 hours ago | 0

Answered

Question about constraints in optimization problems

This is due to the finite precision of floating-point numbers. Calculations on floating points numbers can accumulate errors, so...

Question about constraints in optimization problems

This is due to the finite precision of floating-point numbers. Calculations on floating points numbers can accumulate errors, so...

4 hours ago | 1

Answered

How to form a binary matrix from a given two vectors?

I am not sure how the elements of B are used in C. Consider following code A = 1:10; n = 10; C = arrayfun(@(x) {repmat(x, 1...

How to form a binary matrix from a given two vectors?

I am not sure how the elements of B are used in C. Consider following code A = 1:10; n = 10; C = arrayfun(@(x) {repmat(x, 1...

5 hours ago | 0

Answered

Determine the frequency with find and diff

You can use findpeaks(): https://www.mathworks.com/help/signal/ref/findpeaks.html or islocalmax(): https://www.mathworks.com/hel...

Determine the frequency with find and diff

You can use findpeaks(): https://www.mathworks.com/help/signal/ref/findpeaks.html or islocalmax(): https://www.mathworks.com/hel...

7 hours ago | 0

Answered

I have two 3d points, A(1,0,0) and B(0,1,0). And I connect these two points as a line AB. How to divide this line into 10 equally segments and get their coordinates?

This is one way A = [1,0,0]; B = [0,1,0]; n = 10; X = [A; B]; t = linspace(0, 1, n+1); points = interp1([0 1], X, t) Re...

I have two 3d points, A(1,0,0) and B(0,1,0). And I connect these two points as a line AB. How to divide this line into 10 equally segments and get their coordinates?

This is one way A = [1,0,0]; B = [0,1,0]; n = 10; X = [A; B]; t = linspace(0, 1, n+1); points = interp1([0 1], X, t) Re...

23 hours ago | 1

| accepted

Answered

Can one save the filename as a variable in 'readtable'?

you can save char arrays in a variable and then concatenate it with the extension using [] operator. filename = 'texas'; T = r...

Can one save the filename as a variable in 'readtable'?

you can save char arrays in a variable and then concatenate it with the extension using [] operator. filename = 'texas'; T = r...

23 hours ago | 1

Answered

difference between adjacent elements of a vector

A = [1,4,6,10,33,200]; out = A(1:end-1) - A(2:end); Read about indexing here: https://www.mathworks.com/company/newsletters/ar...

difference between adjacent elements of a vector

A = [1,4,6,10,33,200]; out = A(1:end-1) - A(2:end); Read about indexing here: https://www.mathworks.com/company/newsletters/ar...

23 hours ago | 0

| accepted

Answered

How to find and plot the absolut average error of a fittet curve to a Set of Data

You can add the absolute error between actual datapoints and fitted curve like this p{i} = polyfit(x_relevant{i}, y_relevant{i}...

How to find and plot the absolut average error of a fittet curve to a Set of Data

You can add the absolute error between actual datapoints and fitted curve like this p{i} = polyfit(x_relevant{i}, y_relevant{i}...

1 day ago | 0

Answered

Array indices must be positive or logical values.

In MATLAB, the index of an array starts from 1 (as compared to many other languages where it starts from 0). Therefore, these li...

Array indices must be positive or logical values.

In MATLAB, the index of an array starts from 1 (as compared to many other languages where it starts from 0). Therefore, these li...

1 day ago | 2

| accepted

Answered

How to draw line graph with same values in this bar graph?

Are you looking for something like this x = [1 2 3 4 5 6 7]; temp_high = [149.1350 143.9020 19.1230 19.0350 11.8150 19.8610 1...

How to draw line graph with same values in this bar graph?

Are you looking for something like this x = [1 2 3 4 5 6 7]; temp_high = [149.1350 143.9020 19.1230 19.0350 11.8150 19.8610 1...

1 day ago | 0

Answered

why Matlab websave function doesn't work?

websave() was introduced in R2014b. There is no way to use it in R2014a.

why Matlab websave function doesn't work?

websave() was introduced in R2014b. There is no way to use it in R2014a.

1 day ago | 0

Answered

3D plot of 3 vectors

You first need to convert your data into a grid format using scattered interpolation x = data(:,1); y = data(:,2); z = data(:...

3D plot of 3 vectors

You first need to convert your data into a grid format using scattered interpolation x = data(:,1); y = data(:,2); z = data(:...

1 day ago | 0

| accepted

Answered

How to use For loop or any other loop to rearrange elements in a matrix using Matlab?

Try this M = readmatrix('Boundary_closed_1s_3s.txt'); for i = 1:size(M,1) idx1 = find(M(i,:), 1, 'first'); idx2 = ...

How to use For loop or any other loop to rearrange elements in a matrix using Matlab?

Try this M = readmatrix('Boundary_closed_1s_3s.txt'); for i = 1:size(M,1) idx1 = find(M(i,:), 1, 'first'); idx2 = ...

1 day ago | 1

Answered

How to add values at blue dots in graphs?

There is no general way. You can use text() to place the values, but to customize the location will require manual tweaking. For...

How to add values at blue dots in graphs?

There is no general way. You can use text() to place the values, but to customize the location will require manual tweaking. For...

1 day ago | 0

| accepted

Answered

how to make if accept letters?

Several problem: 1. = is an operator for assignment in MATLAB. For comparison, you need to use == if yesno == y 2. You want t...

how to make if accept letters?

Several problem: 1. = is an operator for assignment in MATLAB. For comparison, you need to use == if yesno == y 2. You want t...

1 day ago | 0

| accepted

Answered

Property validation for a vector

You can use mustBeVector validation function. properties Col {mustBeVector} end Functions are listed here: h...

Property validation for a vector

You can use mustBeVector validation function. properties Col {mustBeVector} end Functions are listed here: h...

2 days ago | 0

| accepted

Answered

1x2 Cell with each ?field? containing 2 values

You have 'a' like this a = {[1 2], [3 4]}; To access first elemets, you need to use indexing like this a{1,1}(1) a{1,2}(1) ...

1x2 Cell with each ?field? containing 2 values

You have 'a' like this a = {[1 2], [3 4]}; To access first elemets, you need to use indexing like this a{1,1}(1) a{1,2}(1) ...

2 days ago | 1

Answered

Indexing of a size() object

Unlink some other languages, such a chain of indexing is not supported in MATLAB. You can find the discussion on this issue on t...

Indexing of a size() object

Unlink some other languages, such a chain of indexing is not supported in MATLAB. You can find the discussion on this issue on t...

2 days ago | 1

| accepted

Answered

arg min for Optimization problem

You can use fminunc(): https://www.mathworks.com/help/optim/ug/fminunc.html or fmincon():https://www.mathworks.com/help/optim/ug...

arg min for Optimization problem

You can use fminunc(): https://www.mathworks.com/help/optim/ug/fminunc.html or fmincon():https://www.mathworks.com/help/optim/ug...

2 days ago | 0

Answered

add labels to x axis

Add this line at the end of your code xticklabels(X)

add labels to x axis

Add this line at the end of your code xticklabels(X)

2 days ago | 0

| accepted

Answered

Problem in putting limit to the variable

'x' is already in this range. You are printing the value of 'extreme_values', not 'extreme_points' syms x f=0.3*(x-0.6)*(x-0.9...

Problem in putting limit to the variable

'x' is already in this range. You are printing the value of 'extreme_values', not 'extreme_points' syms x f=0.3*(x-0.6)*(x-0.9...

2 days ago | 0

Answered

How can we do for following fprintf formating

It is not possible to do such thing in command window currently: https://www.mathworks.com/matlabcentral/answers/255568-putting-...

How can we do for following fprintf formating

It is not possible to do such thing in command window currently: https://www.mathworks.com/matlabcentral/answers/255568-putting-...

2 days ago | 0

Answered

Create matrix with two matrices

You can do something like this A = [1 2 3; 4 5 6;7 8 9]; B = [ 11 12 13;14 15 16;17 18 19]; Matrix = zeros(size(A,1)+size(B,1...

Create matrix with two matrices

You can do something like this A = [1 2 3; 4 5 6;7 8 9]; B = [ 11 12 13;14 15 16;17 18 19]; Matrix = zeros(size(A,1)+size(B,1...

2 days ago | 0

Answered

How to create a Nx3 array from Nx4 array

You can use cellfun() C1; % 100x1 with Nx4 matrices C2 = cellfun(@(x) {x(:,2:end)}, C1);

How to create a Nx3 array from Nx4 array

You can use cellfun() C1; % 100x1 with Nx4 matrices C2 = cellfun(@(x) {x(:,2:end)}, C1);

2 days ago | 0

| accepted