Solved

Project Euler: Problem 2, Sum of even Fibonacci

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te...

22 hours ago

Answered

snapshot problem in video processing

snapshot() is intended for use with a cameraboard object or webcam object and you are attempting you input an image object. You...

snapshot problem in video processing

snapshot() is intended for use with a cameraboard object or webcam object and you are attempting you input an image object. You...

1 day ago | 0

Solved

Project Euler: Problem 6, Natural numbers, squares and sums.

The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...

2 days ago

Answered

How to graph data in cells?

Your data has an empty cell in it so the first step here is to remove that ToBeGraphed(cellfun(@isempty,ToBeGraphed))=[]; % rem...

How to graph data in cells?

Your data has an empty cell in it so the first step here is to remove that ToBeGraphed(cellfun(@isempty,ToBeGraphed))=[]; % rem...

4 days ago | 0

| accepted

Answered

Extract subset of time-curves from a 4D volume

I can reduce this to a single for loop which iterates through the timesteps but i'm not sure about doing this entirely without l...

Extract subset of time-curves from a 4D volume

I can reduce this to a single for loop which iterates through the timesteps but i'm not sure about doing this entirely without l...

15 days ago | 0

| accepted

Answered

Sum of elements in an array over x

a = [0.023 0.056 0.053 0.034 0.021 0.075 0.088]; result = sum(a(a>0.05))

Sum of elements in an array over x

a = [0.023 0.056 0.053 0.034 0.021 0.075 0.088]; result = sum(a(a>0.05))

22 days ago | 1

| accepted

Answered

Building a matrix inside a for loop

You could do it as follows: xlsData = xlsread('PartS_all.xlsx'); partID = xlsData(:,4); uPartID = unique(partID).'; % Unique ...

Building a matrix inside a for loop

You could do it as follows: xlsData = xlsread('PartS_all.xlsx'); partID = xlsData(:,4); uPartID = unique(partID).'; % Unique ...

2 months ago | 0

| accepted

Answered

how to store coordinate values xy[] for randomly generate point

The format you used (based on the code you provided) is a structure and the format you are looking for is an array. To generate ...

how to store coordinate values xy[] for randomly generate point

The format you used (based on the code you provided) is a structure and the format you are looking for is an array. To generate ...

2 months ago | 0

Answered

Multiple combinations of a matrix

Try the following, it should work for any size of M. function x = pairCombos(M) numRows = size(M,1); C = combnk(1:numRows,2...

Multiple combinations of a matrix

Try the following, it should work for any size of M. function x = pairCombos(M) numRows = size(M,1); C = combnk(1:numRows,2...

2 months ago | 0

| accepted

Answered

How to reshape in 3D a downsampled matrix

Easiest thing to do would be just this: newData = data(1:factor:end,1:factor:end,1:factor:end);

How to reshape in 3D a downsampled matrix

Easiest thing to do would be just this: newData = data(1:factor:end,1:factor:end,1:factor:end);

2 months ago | 0

| accepted

Answered

Using a for loop to graph values using different colors

If you want to use scatter so that the color depends on distance, this is how you do it: % Data clear all close all data = [...

Using a for loop to graph values using different colors

If you want to use scatter so that the color depends on distance, this is how you do it: % Data clear all close all data = [...

3 months ago | 1

Answered

Finding Minimum Distance Between Points to Find Indexed Variable

If you don't have the statistics and machine learning toolbox you can do the following: [~,idx] = min(abs(dtamatrix(:,2) - Feli...

Finding Minimum Distance Between Points to Find Indexed Variable

If you don't have the statistics and machine learning toolbox you can do the following: [~,idx] = min(abs(dtamatrix(:,2) - Feli...

4 months ago | 0

| accepted

Answered

Create multiple arrays with different names and specific data

It is possible to do exactly what you asked but that is considered a bad coding practice (explanation here). Why don't you st...

Create multiple arrays with different names and specific data

It is possible to do exactly what you asked but that is considered a bad coding practice (explanation here). Why don't you st...

4 months ago | 0

| accepted

Answered

Creation of an automatic description image

It looks like you have a binary image but you uploaded it as a .jpeg, I have included 3 lines to "workaround" and get back to an...

Creation of an automatic description image

It looks like you have a binary image but you uploaded it as a .jpeg, I have included 3 lines to "workaround" and get back to an...

4 months ago | 0

| accepted

Answered

How to crop a circle from an image?

Try the following tutorial: % Setup clear close all clc inputImg = imread('cameraman.tif'); % Show demo Image hf = figu...

How to crop a circle from an image?

Try the following tutorial: % Setup clear close all clc inputImg = imread('cameraman.tif'); % Show demo Image hf = figu...

4 months ago | 0

| accepted

Answered

calculating area and perimeter for pap-smear image

There are numerous ways you could segment the nucleus, I elected here to threshold based on R,G,B values in the image. To work o...

calculating area and perimeter for pap-smear image

There are numerous ways you could segment the nucleus, I elected here to threshold based on R,G,B values in the image. To work o...

4 months ago | 0

| accepted

Answered

I want to extract values from second column of the matrix which correspond to the range 6 to 7 of the first column. How to do it?

Let's say your matrix is called M, then you can extract rows from column 2 corresponding to those in column 1 which are between ...

I want to extract values from second column of the matrix which correspond to the range 6 to 7 of the first column. How to do it?

Let's say your matrix is called M, then you can extract rows from column 2 corresponding to those in column 1 which are between ...

4 months ago | 0

| accepted

Answered

3-D matrix operations

Here's the method I was suggesting. The idea is to take the first value and add half the difference (effectively interpolating) ...

3-D matrix operations

Here's the method I was suggesting. The idea is to take the first value and add half the difference (effectively interpolating) ...

4 months ago | 0

Answered

Read text file with string

You could use the readmatrix function as follows: filename = 'My2.TXK' opts = detectImportOptions(filename,'FileType','text') ...

Read text file with string

You could use the readmatrix function as follows: filename = 'My2.TXK' opts = detectImportOptions(filename,'FileType','text') ...

4 months ago | 0

| accepted

Answered

Extract data (timestamps) from csv file

You could read the file in as a character vector with fileread and then use regexp as follows: filetext = fileread('Info.csv');...

Extract data (timestamps) from csv file

You could read the file in as a character vector with fileread and then use regexp as follows: filetext = fileread('Info.csv');...

4 months ago | 0

| accepted

Answered

How to Interpolated data outliers

Generate some sample data: C = (1:3630).'; idxout = randperm(3630,500); % random index for outliers C(idxout) = C(idxout)+200...

How to Interpolated data outliers

Generate some sample data: C = (1:3630).'; idxout = randperm(3630,500); % random index for outliers C(idxout) = C(idxout)+200...

4 months ago | 1

| accepted

Answered

matlab code How to dived 400*500 image into 40*50 and calculate object area in each block. put all blocks in one imafe

You can find out which blocks are crops (according to your definitions) as follows: B = blockproc(Img, [40 50], @(block_struct)...

matlab code How to dived 400*500 image into 40*50 and calculate object area in each block. put all blocks in one imafe

You can find out which blocks are crops (according to your definitions) as follows: B = blockproc(Img, [40 50], @(block_struct)...

4 months ago | 0

Answered

By using computervision toolbox I'm trying to play a video in MATLAB using this code, but only one frame is displayed on the window

You could do the following: a = vision.VideoFileReader('spur gear.avi' , 'VideoOutputDataType', 'double'); VideoPlayer = visio...

By using computervision toolbox I'm trying to play a video in MATLAB using this code, but only one frame is displayed on the window

You could do the following: a = vision.VideoFileReader('spur gear.avi' , 'VideoOutputDataType', 'double'); VideoPlayer = visio...

4 months ago | 0

Answered

How can I compare distance (not only between two points, but also a set of points)

As I understand it, you have 10 by 100 points represented in variables X and Y which are both 10 by 100 matrices. A given point ...

How can I compare distance (not only between two points, but also a set of points)

As I understand it, you have 10 by 100 points represented in variables X and Y which are both 10 by 100 matrices. A given point ...

4 months ago | 0

| accepted

Answered

Simulation Domain (Region)?

I would say what you want is the meshgrid function. Have a look at the <https://uk.mathworks.com/help/matlab/ref/meshgrid.html d...

Simulation Domain (Region)?

I would say what you want is the meshgrid function. Have a look at the <https://uk.mathworks.com/help/matlab/ref/meshgrid.html d...

4 months ago | 0

Question

Is there a property to modify the marker size of a drawline graphics object?

I'm using the drawline function and wondering if it would be possible to modify the marker sizes? If for example we have the fol...

4 months ago | 1 answer | 0

Answered

How to reshape a single column matrix in the following example?

If you write the following you can directly modify the CT_matrix, no need to separate it out into a column vector: ind_lte_20 =...

How to reshape a single column matrix in the following example?

If you write the following you can directly modify the CT_matrix, no need to separate it out into a column vector: ind_lte_20 =...

4 months ago | 0

| accepted

Answered

Take the sum of an array until a limit is reached determined by a vector of the same length

For a single result you could write the following to get the sum for an arbitrary track length of 10 mm, and you have the option...

Take the sum of an array until a limit is reached determined by a vector of the same length

For a single result you could write the following to get the sum for an arbitrary track length of 10 mm, and you have the option...

4 months ago | 1

| accepted

Answered

Numbering options in a table

You could change Line 58 to the following: disp(crossSectionInfo.Resistance(str2double(result)))

Numbering options in a table

You could change Line 58 to the following: disp(crossSectionInfo.Resistance(str2double(result)))

4 months ago | 0

Answered

I don't get the correct output from my function

The function is correct. However, because this function outputs very large numbers depending on your range (in terms of absolut...

I don't get the correct output from my function

The function is correct. However, because this function outputs very large numbers depending on your range (in terms of absolut...

4 months ago | 0

| accepted