Answered
Extract numeric year from string
datestr = date; year = str2num(datestr(end-3:end));

11 years ago | 2

Answered
Ability to add two variable on separate lines into a title
title({'Peaks', int2str(2015)})

11 years ago | 0

Answered
How to graph a Piecewise function?
%Theta= 0:(2*pi)/100:2*pi; %the vector lists 100 elemants between 0 and 2Pi % Actually these are 101 elements; % use ...

11 years ago | 0

| accepted

Answered
How do I plot a ROC graph of True Positive vs. False Negative?
The idea of ROC analysis is to have find TP and FP for different, say, 100 thresholds, and then plot(FP, TP) where FP a...

11 years ago | 0

Answered
How to merge two different size matrix logically?
Like this? A = [0, 1, 2, 3, 4, 5, 7, 10]; B = [2, 5, 7]; C(:,1) = A; C(end,2) = 0; % ind = arrayfun(@(x...

11 years ago | 0

| accepted

Answered
Changing function logic parameters depending on outputs
You can use the istilde from http://biorobots.cwru.edu/personnel/adh/stackoverflow/04/ with the caveat that it works just in fu...

11 years ago | 1

| accepted

Answered
Using strepp on a textfile with replacement from array.
A sketch how you could proceed: 1. Read the EXCEL file with xlsread 2. Create long array of char with the desired informat...

11 years ago | 1

| accepted

Answered
how to choose right index
Y = Y(sum(idx, 2) ~= 2, :); plot(Y(:,1), Y(:,2), '.r')

11 years ago | 0

Answered
How can I resize the matrix?
B = A(sum(A') ~= 0, :)

11 years ago | 0

| accepted

Answered
Adding element within vector without overwriting the existing value
X = {'asdf' 'foo' 'bar'}; n = 3; name = 'foooo'; X = {X{1:n-1} name X{n:end}};

11 years ago | 0

Answered
Index of matrices in a for loop
You compute a 3x3xN matrix where N is are the values of theta as follows QN(1,1,:) = Q11*cos(theta).^4+(2*(Q12+2*Q66))*sin(t...

11 years ago | 0

| accepted

Answered
Is it possible to call a subfunction inside a function mscript?
No. You have to create a separate mfile that can be called by your mscript.

11 years ago | 1

| accepted

Answered
Adjusting plot fill to show two colours depending on overestima​tion/under​estimation
Have a look at http://www.mathworks.com/matlabcentral/fileexchange/34876--greater-than--fill or my solution that does need n...

11 years ago | 0

| accepted

Answered
choose elements from array
To compute a cellarray 'combinations' with all 2^N possible combinations of elements, you can use: val = 1:3; N = numel(...

11 years ago | 0

| accepted

Answered
Set new position for x label at semilogx diagram
semilogx(Tr(2:end),SSa,'g*-') hold on semilogx(Tr(2:end),SSb,'b*-') semilogx(Tr(2:end),SSc,'r*-') set(gca, 'XTick'...

11 years ago | 0

Answered
how can i find t closest image in many images?
Well, there is lots of research devoted to this question. One simple way would be to compute the RMS (root mean squared) differe...

11 years ago | 0

Answered
How to read datafiles residing in a different path than the program using the 'load' command or otherwise?
srcdir = 'F:/TP/Data/day' for i = 1:10 fullfilename = [srcdir filesep 'datafile_' int2str(i) '.dat']; %...

11 years ago | 0

Answered
Speeding up matrix multiplication and inversion
If the matrices are sparse, coding them as such using Msparse = sparse(M); may help.

11 years ago | 0

Answered
finding number of pixels inside each circle
A well-known "approximation" is :-) N = round(radius^2*pi) You could also create a circle and count the pixels: rad...

11 years ago | 1

Answered
Matlab help. How to add a file into matlab?
The quick way is to find out current directory (the Present Working Directory) pwd and copy the file to this folder. ...

11 years ago | 3

| accepted

Answered
mapping of matrices with different size
Stephen made some remarks that are useful in general, but in your case you can get along with newdata(:,1) = 0:0.1:1; % fir...

11 years ago | 0

Answered
How to extract residuals from a best fit
The is no space between adjust and the following number in your Locator Repeatability 131 No Coolant.txt file, resulting in Adju...

11 years ago | 0

| accepted

Answered
Finding the value of a line when it falls past a certain value on the y axis
First, don't use "length" as a variable, it's a function in Matlab. I used L instead. In general there will be no value in L ...

11 years ago | 0

Answered
plot smooth curve through discreet points
First you have to interpolate x depending on y. Next, you have to do the interpolation separately for each of the discontinuous ...

11 years ago | 1

| accepted

Answered
How to use negative numbers in MatLab
Use grades(grades < - 1.5) = -3;

11 years ago | 1

Answered
How to concatenate string vectors of unequal length?
v1 = {'a' 'b' 'c'}'; v2 = {'d'}'; v3 = {'e' 'f'}'; m = max([numel(v1) numel(v2) numel(v3)]); if numel(v1) < m, v1{m} =...

11 years ago | 1

Answered
Can I restore the original matrix back from its gray scale image?
If you have normalized the values there is no way back to the original values, because if a matrix M results in image I when nor...

11 years ago | 0

| accepted

Answered
determining number of inputs
N = ('How many times?'); for i=1:N a(i) = ('your input'); end

11 years ago | 0

| accepted

Answered
integration of FFT
The is no such function as int in Matlab. What is int supposed to do?

11 years ago | 1

Answered
Superimpose matrices of different sizes
This works only if A and B have the same number of rows: ind = find(B>0); C = A; C(ind) = B(ind);

11 years ago | 0

Load more