Answered

Why doesnt int2str return string

It's turned your value into a char, not a string. ischar(int2str(F{1,4})) should return true If you look at the function hel...

Why doesnt int2str return string

It's turned your value into a char, not a string. ischar(int2str(F{1,4})) should return true If you look at the function hel...

4 months ago | 0

| accepted

Answered

find finite numbers in B using logic indexing ?

B_finite_only = B(isfinite(B)); B_finite_only_sum = sum(B_finite_only);

find finite numbers in B using logic indexing ?

B_finite_only = B(isfinite(B)); B_finite_only_sum = sum(B_finite_only);

4 months ago | 0

| accepted

Answered

random letter bother upper & lower case

This is a fun puzzle. Upper-case letters run of 65-90 in an ASCII table and lower-case runs from 97 to 122. You can use char to ...

random letter bother upper & lower case

This is a fun puzzle. Upper-case letters run of 65-90 in an ASCII table and lower-case runs from 97 to 122. You can use char to ...

4 months ago | 1

| accepted

Answered

How to obtain indices of cell arrays?

There might be an easier way to do this, but it works. % get the indices of all non-empty cells [row,col] = find(cellfun(@(x) ...

How to obtain indices of cell arrays?

There might be an easier way to do this, but it works. % get the indices of all non-empty cells [row,col] = find(cellfun(@(x) ...

4 months ago | 0

| accepted

Answered

How do I convert a 3x1 cell to a 1x3

The transposition operator will work. a={1,2,3}; % 1x3 cell a = a'; % a now a 3x1 cell a = a'; % a is a 1x3 cell again

How do I convert a 3x1 cell to a 1x3

The transposition operator will work. a={1,2,3}; % 1x3 cell a = a'; % a now a 3x1 cell a = a'; % a is a 1x3 cell again

4 months ago | 0

Answered

How to Increase the rectangular block marker in legend in bar plot

Better design practice is to label the bars directly rather than keeping the label information off the the side in a legend box ...

How to Increase the rectangular block marker in legend in bar plot

Better design practice is to label the bars directly rather than keeping the label information off the the side in a legend box ...

4 months ago | 0

Answered

How to define both integer and decimal increment in one for loop?

I'm not clear on what you're looking for. Do you want something like this: span1 = 0:0.1:1; span2 = 3:2:30; span = [span1 spa...

How to define both integer and decimal increment in one for loop?

I'm not clear on what you're looking for. Do you want something like this: span1 = 0:0.1:1; span2 = 3:2:30; span = [span1 spa...

4 months ago | 0

Answered

Indexing all the row data for each column

For a 2D matrix, you can access a row as follows: % Matlab indexing is row major % return single row of matrix A A(1,:) A(2,...

Indexing all the row data for each column

For a 2D matrix, you can access a row as follows: % Matlab indexing is row major % return single row of matrix A A(1,:) A(2,...

4 months ago | 0

Solved

Mysterious digits operation (easy)

What is this digit operation? 0 -> 0 1 -> 9 121 -> 9 44 -> 6 15 -> 5 1243 -> 7 ...

6 months ago

Solved

Set a diagonal

Given a matrix M, row vector v of appropriate length, and diagonal index d (where 0 indicates the main diagonal and off-diagonal...

6 months ago

Solved

Determine the number of odd integers in a vector

Determine the number of unique odd integers in a vector. Examples: Input x = [2 5 8 3 7 1]; Output y = 4; Inp...

6 months ago

Solved

String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values

<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

6 months ago

Solved

Cell Counting: How Many Draws?

You are given a cell array containing information about a number of soccer games. Each cell contains one of the following: * ...

6 months ago

Solved

Convert a Cell Array into an Array

Given a square cell array: x = {'01', '56'; '234', '789'}; return a single character array: y = '0123456789'

6 months ago

Solved

Remove element(s) from cell array

You can easily remove an element (or a column in any dimension) from a normal matrix, but assigning that value (or range) empty....

6 months ago

Solved

Split a string into chunks of specified length

Given a string and a vector of integers, break the string into chunks whose lengths are given by the elements of the vector. Ex...

6 months ago

Solved

Fix the last element of a cell array

Note: this is lifted directly from <http://www.mathworks.com/matlabcentral/answers/82825-puzzler-for-a-monday Puzzler for a Mond...

6 months ago

Solved

Can we make a triangle?

Given three positive number, check whether a triangle can be made with these sides length or not. remember that in a triangle su...

6 months ago

Solved

Find the sides of an isosceles triangle when given its area and height from its base to apex

Find the sides of an isosceles triangle when given its area and the height from its base to apex. For example, with A=12 and ...

6 months ago

Solved

Height of a right-angled triangle

Given numbers a, b and c, find the height of the right angled triangle with sides a and b and hypotenuse c, for the base c. If a...

6 months ago

Solved

Right Triangle Side Lengths (Inspired by Project Euler Problem 39)

If _p_ is the perimeter of a right angle triangle with integral length sides, { _a_, _b_, _c_ }, there are exactly three solutio...

6 months ago

Solved

Find my daddy long leg (No 's')

Given the ratio of the two legs (longer / shorter), and the hypotenuse length, find the value of the bigger leg.

6 months ago

Solved

Approximation of Pi

Pi (divided by 4) can be approximated by the following infinite series: pi/4 = 1 - 1/3 + 1/5 - 1/7 + ... For a given numbe...

7 months ago

Solved

Given a square and a circle, please decide whether the square covers more area.

You know the side of a square and the diameter of a circle, please decide whether the square covers more area.

7 months ago

Solved

Perimeter of a semicircle

Given the diameter d, find the perimeter of a semicircle

7 months ago

Solved

Pi Digit Probability

Assume that the next digit of pi constant is determined by the historical digit distribution. What is the probability of next di...

7 months ago

Solved

Pi Estimate 1

Estimate Pi as described in the following link: <http://www.people.virginia.edu/~teh1m/cody/Pi_estimation1.pdf>

7 months ago

Solved

Calculate area of sector

A=function(r,seta) r is radius of sector, seta is angle of sector, and A is its area. Area of sector A is defined as 0.5*(r^2...

7 months ago