Answered
how can i compare two string matrix with conditions ?
>> a={'yes','yes';'no','no'}; >> b={'no','yes';'yes','no'}; >> X = strcmp(cat(3,a,b),'yes'); >> Y = 1 + diff(X,1,3) +...

11 years ago | 0

| accepted

Answered
How to calculate minimum if there are more maximum values in a column?
You need to learn how to use <http://de.mathworks.com/help/matlab/math/matrix-indexing.html logical indexing>, which is a very f...

11 years ago | 1

Answered
Conversion of 3d array to 2d array in text file
|textscan| returns empty arrays is because it could not match the provided format string with the actual data in the file. It ca...

11 years ago | 1

| accepted

Answered
How to find maximum value from different array in spesific dimension
This is the neatest solution, with the numeric arrays in one cell array: C{1} = rand(3); C{2} = rand(3); max(vertcat(...

11 years ago | 0

Answered
HELP PLEASE!! How do I print matlab "1:5 multiply increases each line"
Without any loops, using <http://de.mathworks.com/help/matlab/matlab_prog/vectorization.html vectorized code>. Note that you can...

11 years ago | 0

| accepted

Answered
how to replace the name of image with a number?
This converts the first digits into their relative indices, putting them into ascending order: C = {'464_img_2','464_img_3'...

11 years ago | 0

| accepted

Answered
Count Zeros Length Matrix Into an Array
>> m = [0 0 0 0 1 2 2 0 0 5 3 4 5 0 0 0 0 0 9 9 0 0 0]; >> x = find(diff([false,m==0,false])); >> x(2:2:end)-x(1:2:end) ...

11 years ago | 1

| accepted

Answered
How we can skip copying codes ?
Write functions. Instead of writing/copying code into lots of different locations, write a function to perform each task and ...

11 years ago | 1

| accepted

Answered
How do I set the value of the heaviside function at the origin (or shifted origin) to be 1, not 0.5?
This is equivalent to myHeav = @(X)double(X>=0);

11 years ago | 0

Answered
Creation of matrix (72,1) by defined elements
ub = reshape([Pstmax,Pproda,Pprodb].',[],1) or if they could be row vectors: ub = reshape([Pstmax(:),Pproda(:),Pprodb(...

11 years ago | 1

| accepted

Answered
Anonymous function is from which version existing?
MATLAB 7 (R14, 2004) _"Two new language features in MATLAB 7, anonymous functions and nested functions, address these issues ...

11 years ago | 1

| accepted

Answered
decimal to binary conversion of recurring decimal numbers
MATLAB's default numeric type is the <https://en.wikipedia.org/wiki/Double-precision_floating-point_format IEEE 754 |double|>, a...

11 years ago | 1

| accepted

Answered
Request user input and using that ans for my functions?
>> val = str2double(answer{1}) val = 3

11 years ago | 0

| accepted

Answered
how do I grab multiple multiple intervals of a given variable and put them into a new variable?
You can use <http://www.mathworks.com/help/matlab/math/matrix-indexing.html indexing> to obtain any elements of another array: ...

11 years ago | 0

Answered
Write a text string into a cell in a matrix
You are confusing <http://www.mathworks.com/help/matlab/cell-arrays.html cell arrays> and <http://www.mathworks.com/help/matlab/...

11 years ago | 0

Answered
Textscan error in code
Basically this means that |fopen| did not manage to open any file, and returned an error value instead of a valid file identifie...

11 years ago | 1

| accepted

Answered
How to detect if a figure exist?
The most reliable solution is to move your programming up a notch: use explicit handles and keep track of them. While |gcf| a...

11 years ago | 1

Answered
Split a row into several rows
A matrix cannot have gaps or missing values: every row must be the same length, just as every column must too. So you will have ...

11 years ago | 0

| accepted

Answered
How to link markers with lines in for loop
Solution: learn to program MATLAB code without using loops everywhere. Although beginners think that loops are great for solv...

11 years ago | 0

Answered
how can i complete the line points ?
Read the image into MATLAB, fit the line using <http://www.mathworks.com/help/matlab/ref/polyfit.html |polyfit|>, and then plot ...

11 years ago | 0

| accepted

Answered
hi, I want to divide a matrix in 2 parts vertically
>> B = A(:,1:4) B = 1 2 0 4 4 5 0 0 0 1 4 7 >> C = A(:,5:end) C = 1 6 ...

11 years ago | 0

| accepted

Answered
Delete entire row of an array
Use <http://www.mathworks.com/help/matlab/ref/any.html |any|> and <http://www.mathworks.com/help/matlab/math/matrix-indexing.htm...

11 years ago | 0

| accepted

Answered
Can anyone help me to find out why I can't replace pixel values at (x, y-1) and (x+1, y) with the value at (x, y) ?
N = 5; E = [5,20]; % X = magic(N); Y = false(N+2); for k = 1:numel(E); Y(2:end-1,2:end-1) = X==E(k); ...

11 years ago | 0

| accepted

Answered
Can you please explain me this for loop in this code,How this is running
Explanation: that code is very inefficient way to find the indices of "runs of ones" in the variable |idx|. Basically it detects...

11 years ago | 0

| accepted

Answered
Undefined function 'eq' for input arguments of type 'cell'.
<http://www.mathworks.com/help/matlab/ref/relationaloperators.html Relational operators> can be used with numeric arrays or char...

11 years ago | 1

| accepted

Answered
Copying a matrix into another larger matrix multiple times
You don't need to reinvent the wheel using slow and inefficient nested loops, just use <http://www.mathworks.com/help/matlab/ref...

11 years ago | 0

| accepted

Answered
Repeating a random generator
You do not need a loop, it is much faster to generate all of the random values at once and assign them using indexing: >> T...

11 years ago | 0

Answered
Hii I am not understanding this code please help and explain me step by step and please explain me idx2 = [0, idx, 0] what does it do.
That bit of code concatenates zeroes onto both ends of the vector |idx|, and allocates this lengthened vector to a new variable ...

11 years ago | 0

| accepted

Answered
How to find prefix and postfix in a recursive way
C = {'23414','342(1)','34','231'}; pfx = cellfun(@(s)regexp(s,'\d','match'),C,'UniformOutput',false); fun = @(s)arrayfun...

11 years ago | 0

| accepted

Load more