Answered

Obtain every possible combination in array

Here's a brute force generation of all combinations. Memory usage is more of a bottleneck than processing time, so I wrote it wi...

Obtain every possible combination in array

Here's a brute force generation of all combinations. Memory usage is more of a bottleneck than processing time, so I wrote it wi...

4 years ago | 0

Answered

Array manipulation: Suppose you have an array.How to take windows with overlapping along column and repeat to next doing same

Indexing and stacking as shown below will work for your example. Does this work for your real use case also? a = [1 2 3 4 5;...

Array manipulation: Suppose you have an array.How to take windows with overlapping along column and repeat to next doing same

Indexing and stacking as shown below will work for your example. Does this work for your real use case also? a = [1 2 3 4 5;...

4 years ago | 0

| accepted

Answered

Using strcmp on multiple strings to get a logical array

There's really nothing wrong with a for loop in this case. However, cellfun is probably what you're looking for: Event = {'a...

Using strcmp on multiple strings to get a logical array

There's really nothing wrong with a for loop in this case. However, cellfun is probably what you're looking for: Event = {'a...

4 years ago | 3

| accepted

Answered

performance when copying data from object array to cell

Darim, Since you are not pre-allocating the *data* cell, Matlab is probably expanding the size of *data* iteratively. With pr...

performance when copying data from object array to cell

Darim, Since you are not pre-allocating the *data* cell, Matlab is probably expanding the size of *data* iteratively. With pr...

4 years ago | 0

| accepted

Answered

Re-synchronizing TEXTSCAN

dpb, I made a generalized solution to this problem some time ago for the constant questions about parsing delimited text file...

Re-synchronizing TEXTSCAN

dpb, I made a generalized solution to this problem some time ago for the constant questions about parsing delimited text file...

4 years ago | 0

Answered

How do I play sound when a key is pressed

Michael, This article describes how to record and play sound. https://www.mathworks.com/help/matlab/import_export/record-...

How do I play sound when a key is pressed

Michael, This article describes how to record and play sound. https://www.mathworks.com/help/matlab/import_export/record-...

4 years ago | 0

| accepted

Answered

How to have MATLAB 2016 Legend without box and as transparent?

SL, Check out the Matlab documentation on the legend function. Special arguments can be passed in as name value pairs when cr...

How to have MATLAB 2016 Legend without box and as transparent?

SL, Check out the Matlab documentation on the legend function. Special arguments can be passed in as name value pairs when cr...

4 years ago | 0

Answered

How to round a result to two decimal places

Mo'men, Check out the round function. r_rounded = round(r,2); % rounds to 2 decimal places Hope this helps.

How to round a result to two decimal places

Mo'men, Check out the round function. r_rounded = round(r,2); % rounds to 2 decimal places Hope this helps.

4 years ago | 14

Answered

How to save an image using imwrite with a filename from a variable

Hi Nalini, You can combine string values using square brackets. The syntax for imwrite using your variable names is as follow...

How to save an image using imwrite with a filename from a variable

Hi Nalini, You can combine string values using square brackets. The syntax for imwrite using your variable names is as follow...

4 years ago | 2

| accepted

Answered

Write a function called mystaff that takes one input matrix called S. S is an n-by-m matrix whose elements are salaries. Salaries.xlsx Doesn't return a value How do I use my function to find average salary of principe: principle >= 140000.

Khalid, I suspect you are pressing the "Run" button with your function file open. Your function needs to return the final...

Write a function called mystaff that takes one input matrix called S. S is an n-by-m matrix whose elements are salaries. Salaries.xlsx Doesn't return a value How do I use my function to find average salary of principe: principle >= 140000.

Khalid, I suspect you are pressing the "Run" button with your function file open. Your function needs to return the final...

4 years ago | 0

Answered

How can I change the number of MinorTicks between MajorTicks?

Hi Geovana, I think your questions is answered here: <https://www.mathworks.com/matlabcentral/answers/102945-how-can-i-speci...

How can I change the number of MinorTicks between MajorTicks?

Hi Geovana, I think your questions is answered here: <https://www.mathworks.com/matlabcentral/answers/102945-how-can-i-speci...

4 years ago | 0

Answered

Extract matrix subset based on latitude and longitude

Janet, These conditions are contradictory: all_time(:,1)<27.5 & all_time(:,1)>28.0 None of your values could be below...

Extract matrix subset based on latitude and longitude

Janet, These conditions are contradictory: all_time(:,1)<27.5 & all_time(:,1)>28.0 None of your values could be below...

4 years ago | 0

Answered

Storing and accessing large amounts of time-based data

Hi Ben, You have discussed your ideas and questions regarding the Matlab data structures that allow for easy access and manip...

Storing and accessing large amounts of time-based data

Hi Ben, You have discussed your ideas and questions regarding the Matlab data structures that allow for easy access and manip...

4 years ago | 2

Answered

Sum of array items into another array

Assuming data is a struct with fields speed1, speed2, etc. sumArray = structfun(@sum,data);

Sum of array items into another array

Assuming data is a struct with fields speed1, speed2, etc. sumArray = structfun(@sum,data);

5 years ago | 3

| accepted

Answered

Error when running deployed stand-alone application that uses mex files for c++ code

That error is thrown because the <http://www.mathworks.com/help/matlab/ref/mex.html mex> command attempts to compile a c++ file ...

Error when running deployed stand-alone application that uses mex files for c++ code

That error is thrown because the <http://www.mathworks.com/help/matlab/ref/mex.html mex> command attempts to compile a c++ file ...

5 years ago | 1

| accepted

Solved

Increment a number, given its digits

Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

5 years ago

Solved

Find a Pythagorean triple

Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them com...

5 years ago

Solved

Side of a rhombus

If a rhombus has diagonals of length x and x+1, then what is the length of its side, y? <<http://upload.wikimedia.org/wikipe...

5 years ago

Solved

Triangle sequence

A sequence of triangles is constructed in the following way: 1) the first triangle is Pythagoras' 3-4-5 triangle 2) the s...

5 years ago

Solved

Side of an equilateral triangle

If an equilateral triangle has area A, then what is the length of each of its sides, x? <<http://upload.wikimedia.org/wikipe...

5 years ago

Solved

Dimensions of a rectangle

The longer side of a rectangle is three times the length of the shorter side. If the length of the diagonal is x, find the width...

5 years ago

Solved

Area of an equilateral triangle

Calculate the area of an equilateral triangle of side x. <<http://upload.wikimedia.org/wikipedia/commons/e/e0/Equilateral-tr...

5 years ago

Solved

Is this triangle right-angled?

Given any three positive numbers a, b, c, return true if the triangle with sides a, b and c is right-angled. Otherwise, return f...

5 years ago

Solved

Area of an Isoceles Triangle

An isosceles triangle has equal sides of length x and a base of length y. Find the area, A, of the triangle. <<http://upload...

5 years ago

Solved

Length of a short side

Calculate the length of the short side, a, of a right-angled triangle with hypotenuse of length c, and other short side of lengt...

5 years ago

Solved

Length of the hypotenuse

Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<http://upload....

5 years ago

Solved

Is this triangle right-angled?

Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...

5 years ago

Solved

How long is the longest prime diagonal?

Stanislaw Ulam once observed that if the counting numbers are <http://en.wikipedia.org/wiki/Ulam_spiral arranged in a spiral>, t...

5 years ago

Solved

Find the biggest empty box

You are given a matrix that contains only ones and zeros. Think of the ones as columns in an otherwise empty floor plan. You wan...

5 years ago