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

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

5 years ago | 1

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

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

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

5 years ago | 0

Answered
why Matlab websave function doesn't work?
websave() was introduced in R2014b. There is no way to use it in R2014a.

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

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

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

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

5 years ago | 0

| accepted

Answered
Property validation for a vector
You can use mustBeVector validation function. properties Col {mustBeVector} end Functions are listed here: h...

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

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

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

5 years ago | 0

Answered
add labels to x axis
Add this line at the end of your code xticklabels(X)

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

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

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

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

5 years ago | 0

| accepted

Answered
Non-linearly spaced axis
You need to set the xscale to 'log'. Run the following line after creating the plot xlim([0.01 1000]) set(gca, 'XScale', 'log'...

5 years ago | 0

| accepted

Answered
Plotting the given Trigonometric functions
You can use fimplicit() fun = @(x, y) y.*sin(2*x) - x.*cos(2*y); fimplicit(fun, [-10 10 -10 10])

5 years ago | 0

| accepted

Answered
solution of a system non linear equations
If your system of equations has multiple solutions, fsolve() can only give you a single solution based on the initial point x0. ...

5 years ago | 1

| accepted

Answered
how do i substract the first value from the last one on an array taking out zero values?
If all the non-zero values are in increasing order, the try this M(M~=0) = M(M~=0) - min(M(M~=0)); Result >> M = [ 0 ...

5 years ago | 0

Answered
get the image from the NYu depth dataset
The screenshow shows that the dataset loads images in a 4D array. You need to specify which image you want to see. For example ...

5 years ago | 0

Answered
Undefined function or variable error
This usually means that MATLAB is not able to see the file get_kmers.m. MATLAB can only see a file if it is on its search path. ...

5 years ago | 0

| accepted

Answered
Create delimited random vertices
You can sort the randomly generated values x = sort(randi([1 49], 5, 1)); y = sort(randi([1 49], 5, 1));

5 years ago | 0

| accepted

Answered
How can I concatenate 163 matrices into a single matrix with a loop?
The first problem here is to name your variable like G1, G2, ..., G163. It is known to be a bad coding practice: https://www.mat...

5 years ago | 1

| accepted

Answered
Write text below the photo
You can use xlabel to write something below the axes. xlabel('PSNR') Otherwise, you can also use text(), but this option is a ...

5 years ago | 0

| accepted

Answered
how to use "fullfile" with exportgrahics
exportgraphics(gcf, fullfile(directory, fileName)', 'eps', 'Resolution',3000) %...

5 years ago | 0

| accepted

Answered
How i extract the components of a vector/matrix output ?
Yes, that is the syntax. a(1) and a(2) a=polyfit(x,y,1); first_element = a(1); second_element = a(2); Read about indexing he...

5 years ago | 0

| accepted

Load more