Solved


Cell joiner
You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...

13 years ago

Solved


Triangle Numbers
Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

13 years ago

Answered
Combining excel files in a single file
You could do something like that (not tested): nRows = .. you define it. nCols = 1000 ; buffer = zeros(nRows, nCols) ;...

13 years ago | 0

| accepted

Answered
Form a matrix from a structure
If it is a cell array and cells contents have matching sizes: >> doc cell2mat

13 years ago | 1

Answered
Looping over folders, skipping a folder if a file is present
EDIT: jump to the solution provided by Image Analyst, it is better. You should use |fullfile()| for building |subdirpath|. No...

13 years ago | 0

Answered
Create sparse matrix with zig-zag diagonal
You could use |sparse()|, building appropriate vectors of indices and values, e.g.: nCol = size(A, 2) ; nRow = nCol * size...

13 years ago | 0

| accepted

Answered
[DISCONTINUED] MATLAB Answers Wish-list #2 (and bug reports)
Another feature that I would really appreciate is a _select_ instead of the _checkbox_ "Email me when answers are added to this ...

13 years ago | 0

Solved


Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

13 years ago

Solved


Swap the first and last columns
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

13 years ago

Answered
Is there a built-in way to build a GET url in Matlab from a set of parameters?
If you just want to build a string from multiple components, you can use |sprintf|, e.g. >> v = 3 ; >> subfolder = 'WWW' ;...

13 years ago | 1

| accepted

Answered
How do I create orthogonal basis based on two "almost" perpendicular vectors?
If you have no preference about which component to modify, you could perform something as simple as >> Z(end) = -Z(1:2)*Y(1:...

13 years ago | 1

| accepted

Answered
How to extract data from a srting?
Solution with a regexp: regexp(s, '(?<=associate:).*(?=Start)', 'match') where |s| contains your string. EDIT: the fol...

13 years ago | 1

| accepted

Solved


Find perfect placement of non-rotating dominoes (easier)
Given a list of ordered pairs, find the order they should be placed in a line, such that the sum of the absolute values of the d...

13 years ago

Solved


Determine if input is odd
Given the input n, return true if n is odd or false if n is even.

13 years ago

Solved


Find all elements less than 0 or greater than 10 and replace them with NaN
Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

13 years ago

Solved


Find the sum of all the numbers of the input vector
Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

13 years ago

Solved


Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

13 years ago

Solved


Is my wife right?
Regardless of input, output the string 'yes'.

13 years ago

Solved


Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

13 years ago

Solved


Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

13 years ago

Solved


Times 2 - START HERE
Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

13 years ago

Answered
[DISCONTINUED] MATLAB Answers Wish-list #2 (and bug reports)
As mentioned <http://www.mathworks.com/matlabcentral/answers/59216-discussion-about-answers-votes here>, I think that having the...

13 years ago | 3

Answered
[DISCONTINUED] MATLAB Answers Wish-list #2 (and bug reports)
I think that if people were reminded (e.g. weekly) on a verified email that they have to come back to "close" their threads (or ...

13 years ago | 1

Answered
how to make fscanf faster
15 years ago, I would use |fread| and "format" the data myself. I don't know how the technology evolved, but my guess is that |f...

13 years ago | 3

| accepted

Answered
Finding the index value corresponding to a value closest to 0 in an array
You have several options. The first question is: do you really need the index, or could you use a vector of logicals, e.g. for i...

13 years ago | 3

Answered
repeat a loop for 10 times
Your for loop statement is not built correctly: for iterations=10 will just give |iterations| the value 10 and will execu...

13 years ago | 0

Answered
replace nan values with the mean of other cell array
You could build a solution based on the following: % -- Build a lookup table that associates to each JDay the mean of data ...

13 years ago | 0

| accepted

Answered
i need to convert a cell with different datatype to a matrix please any one help me to do this
If you always have this structure with a numeric array first and then cell arrays, and if the second part of my comment above is...

13 years ago | 0

| accepted

Answered
How can I save data to a CSV file in the format I want?
You cannot access a file in column. You have several options for achieving what you want, that will in principle all have the sa...

13 years ago | 1

Answered
grouping elements of a column that correspond to specific elements from another column
I would go for something like that: >> cName = 'MN' ; >> flagCountry = cellfun(@(cntry)strcmp(cntry, cName), out1(:,1)) ; ...

13 years ago | 0

| accepted

Load more