Answered
Read .txt file into a matrix
Try this M = readmatrix('MLS-Aura_L2AK-O3-LAT70N_v04-2x_0000d000.txt', 'NumHeaderLines', 22); M = reshape(M.', 60, []).'; M...

5 years ago | 1

| accepted

Answered
how do I check if my graph cross verticle lines
See the FEX package: https://www.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections. Based on how you draw the ...

5 years ago | 0

Answered
Problem with simplify function used with matrices
MATLAB's symbolic toolbox is not perfect (perhaps it is impossible to make a perfect symbolic engine), and every year they make ...

5 years ago | 0

| accepted

Answered
Combine columns of a matrix based on equality
Try this a = [1 1 1 0;1 0 0 0;0 0 0 1;1 1 1 0; 0 0 0 1]; b = [2 2 2 0; 1 0 0 0; 0 0 0 2]; [M, ~, idx] = unique(a, 'rows', '...

5 years ago | 0

| accepted

Answered
Importing ascii file in matlab with tab as delimiter
On R2020b, you can simply use readtable() on the file itself T = readtable('data.txt') 'data.txt' is attached. >> T.time ans...

5 years ago | 0

Answered
Break title into multiple lines? Part 2
What you have already wrote is the correct syntax title1 = 'You can do it'; title2 = 'with a cell array'; title({[title1] [ti...

5 years ago | 0

Answered
Using strfind with inputs and outputs
See fileparts(): https://www.mathworks.com/help/matlab/ref/fileparts.html. It is easier to use for this question.

5 years ago | 0

Answered
How to improve my regression problem having a low accuracy?
Linear regression has a closed-form solution, i.e., you can get the globally optimum solution by just putting values in an equat...

5 years ago | 0

Answered
ODE45 must return column vector
What are the values of alpha and beta you are using? Following code works without error I=[80,131,189,270,320,407,450,530,620,6...

5 years ago | 0

Answered
Solving nonlinear equation using lsqnonlin
As Walter already explained that there is no guaranteed way to get a globally optimum solution for an arbitrary problem using a ...

5 years ago | 0

Answered
organize vector, difference between adjacent elements of a vector
The rule you described in just A-2 A=[3 ,10, 55 ,100 ,888]; B = A-2; Result >> B B = 1 8 53 98 886 In th...

5 years ago | 0

Answered
can anyone program the solution and graph for this function
See ode45(): https://www.mathworks.com/help/matlab/ref/ode45.html espically see the example titled "Solve Nonstiff Equation". F...

5 years ago | 0

Answered
checking if a variable contains another variable
The variable name used as input to the function is arbitrary. There is no good way to distinguish between m = dydx(x) and m = dy...

5 years ago | 0

Answered
How to change char array matrix to numerical matrix in gui
Try str2num() c = [ '0.15625 ' '-2.28125' '8.59375 ' '-2.46875']; x = str2num(c) Result >> x x = 0...

5 years ago | 0

Answered
Write a program to print all prime numbers between 10 and 100 using for loop
See my answer to your other question: https://www.mathworks.com/matlabcentral/answers/667993-write-a-complete-matlab-program-usi...

5 years ago | 0

Answered
A person, who is infected by Novel Corona virus, can spread infection unto 3 people in one day. Initially there is 1 infected person.
The pattern is just a sequence of powers of 2 x = 2.^(2:2:10) you can use it with fprintf(): https://www.mathworks.com/help/ma...

5 years ago | 0

Answered
Write a complete MATLAB program using while loop that will take a number from user as input and display whether the number is a prime or not. Your program should be able to handle invalid inputs.
These FEX packages can help you in solving your homework problem: https://www.mathworks.com/matlabcentral/fileexchange/32774-th...

5 years ago | 0

Answered
How to sort dependent vectors?
Second outout if sort() gives the index used to sort the vector. You can use it to arrange element of B. A=[0 8 2 9 1 10 23]; ...

5 years ago | 0

| accepted

Answered
Bu soruyu yapamadım. Yardımcı olabilir misiniz?
Read about following function linsolve(): https://www.mathworks.com/help/matlab/ref/linsolve.html mldivide: https://www.mathwo...

5 years ago | 0

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

5 years ago | 0

| accepted

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

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

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

5 years ago | 0

| accepted

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

5 years ago | 0

| accepted

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

5 years 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;

5 years ago | 1

| accepted

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

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

5 years ago | 1

| accepted

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

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

5 years ago | 1

| accepted

Load more