Answered
issue when creating a long vector
You can scale the values before you use interp1. Something along these lines: xi = 1:60e5; x_scaled = x * 1e5 ; yi = ...

12 years ago | 0

Answered
name of variables from a cell of strings
*Do not do this!* Use structs b={'alpha', 'beta', 'gamma'} x.(b{1}) = 1:3 x.(b{2}) = 'hello' x.(b{3}) = NaN ...

12 years ago | 0

Answered
finding repetition numbers in array.
Your question title (finding repetition numbers) and your question text ("how many times exist") are open for ambiguity. For ...

12 years ago | 16

Answered
How to merge cells together?
Another option using STRCAT A = {'apple.doc', 'apple.xlsx', 'apple.csv', 'banana.doc', 'banana.xlsx'} B = strcat(A,';') ...

12 years ago | 0

Answered
How to compute regions of matrix
Trivial, provided you have the image processing toolbox. Take a look at BWLABEL and REGIONPROPS M = [ 0 0 0 0 0 0 0...

12 years ago | 0

| accepted

Answered
cellarray which contains different types of data
A = {'text', 1000, 2000, 'data'} A_as_strings = cellfun(@num2str, A, 'un', 0) and then you can use ismember ...

12 years ago | 1

| accepted

Answered
Repeative selecting unique values of matrix
Here is a working algorithm M = [2 3 8 1 4 7 6 5 9 ; 1 3 8 9 4 6 5 2 7 ; 2 8 1 4 6 3 9 5 7] P = ze...

12 years ago | 1

| accepted

Answered
Problem regarding to change conversion of cell2mat.
This is a case for PADCAT: my_cell={[1,10],[1,2,10],[1,6,10]} result = padcat(my_cell{:}) PADCAT can be downloaded fr...

12 years ago | 0

Answered
How do I compare two sets of numerical strings character by character on Matlab ?
a = '1011101' b = '1011000' q = a~=b % a logical array, true for locations where a and b differ n = nnz(q) % ...

12 years ago | 1

Answered
Switch from one case to another?
use functions, for instance, implemented as sub-functions in your main function. Like this, perhaps: function MainFunctio...

12 years ago | 0

| accepted

Answered
arrayfun with different dimensions
So you want 20 sums in total (5 values of x combined with 4 values of y)? x = 1:5 y = 1:4 [XX,YY] = ndgrid(x,y) ...

12 years ago | 0

Answered
arrayfun with different dimensions
_factorial(1:k)_ will give you a vector with k values while _factorial(1:k-1)_ will a vector with k-1 values. You simply cannot ...

12 years ago | 0

| accepted

Answered
What does the ~ and | mean in the following code?
take a look at this example A = 1:10 q = A < 4 p = A < 7 np = ~p r = q | np B = A(r) help not help...

12 years ago | 0

Answered
How to finish this function?
Since you may assume that the numbers in the vector are unique you can sum up all numbers (using SUM), subtract the smallest and...

12 years ago | 0

| accepted

Answered
How to write a function to delete the duplicated arrays?
A = [1 2 2 2 3 1 1] tf = [true diff(A)~=0] B = A(tf)

12 years ago | 2

Answered
Plotting a sum with a variable
Creat a function and use arrayfun: fh = @(k) sum(factorial(k) ./ factorial(1:k) .* factorial(k-(1:k))) % function handle ...

12 years ago | 0

| accepted

Answered
find similar element in a matrix
As for your first question, take a look at my PADCAT function on the File Exchange as it does exactly what you want. <http://ww...

12 years ago | 0

Answered
problem for creating vector with for loop
Many roads to Rome: A = {'w' 'c' 'e'} n = 2 AA1 = A(kron(1:numel(A),ones(1,n))) AA2 = reshape(repma...

12 years ago | 0

Answered
Can someone help me with my code? with an example
Write a function like this function CK = convertFahrenheit (F) % CONVERTFAHRENHEIT - converts temperature % % CK ...

12 years ago | 0

Answered
std for a growing data range
Here is the completely vectored code for the running sample standard deviation across the rows of a matrix X: X = ceil(10*r...

12 years ago | 0

Answered
How can I convert a numeric matrix(a) to a 0 and 1 matrix(b)?
No need for for-loops. This shows the power of linear indexing: a = [3 1 4 2] % these specify column indices b = zer...

12 years ago | 0

Answered
Matrix from a for FOR loop with IF conditioning
n = size(A,1) ... B(i,:) = x ...

12 years ago | 0

Answered
how to find a string within a filename?
NAMES = {'apple.doc', 'apple2.csv', 'TESTappleTEST.xls', 'banana.doc', 'banana2.csv', 'banana3.xls','APPL_almost.txt'} C = ...

12 years ago | 0

Answered
How to create a vector in which numbers increase at first, then remain constant, then reduce back to 1 ?
If N is your fixed length and M is the maximum number (-> (1 2 … M-1 M M M M-1 … 2 1"), here is a simply code: N = 20 , M ...

12 years ago | 0

Answered
Removing the integral part of number from a matrix
A - fix(A)

12 years ago | 0

| accepted

Answered
Replace bad data in a 24x45x65 matrix. zeroes and values greater than 10 etc..
What you are after is called outlier analysis. What do with recordings that are "bad" or out of range. Simply replacing them wit...

12 years ago | 0

Answered
input equation from user
str = input('Give an equation in x: ','s') ; % the user types in, for instance 2*x^2-3*x+4 x = input('Type in a valu...

12 years ago | 5

| accepted

Answered
replace multiple "1" with only one "1"
Why not operate on the string array and then convert it to ascii? Like this: FF1 = 'eE_?@ wwqy W' FF3 = double(reg...

12 years ago | 0

Answered
Please explain the following code
This codes reads in a file, shows messages in the command window, makes a plot, calls a few sub functions that perform a lot of...

12 years ago | 0

Answered
How to separate an image to rgb?
Is your image a RGB image with 3 dimensions? RedValues = MyImage(:,:,1) ...

12 years ago | 0

Load more