Answered

Check if input is a 4 element vector

if size(x,2)~=4 || ~isvector(x) || ~isnumeric(x) error('Input must be a row vector of length 4') end

Check if input is a 4 element vector

if size(x,2)~=4 || ~isvector(x) || ~isnumeric(x) error('Input must be a row vector of length 4') end

environ 7 heures ago | 0

Answered

video processing for motion detection

So the method I suggested was to look at a single pixel, though you could also look at a few, or the entire image histogram, up ...

video processing for motion detection

So the method I suggested was to look at a single pixel, though you could also look at a few, or the entire image histogram, up ...

environ 14 heures ago | 0

| accepted

Answered

How to check if a table exists?

If you have a table assigned to the variable T, then I believe you just need to write: if ~exist('T')==1 to check that it does...

How to check if a table exists?

If you have a table assigned to the variable T, then I believe you just need to write: if ~exist('T')==1 to check that it does...

3 jours ago | 0

| accepted

Answered

Intersecting Two Lines with Varying Angle

So I understand you just want to plot two lines where there is a specific angle between them. If we take one line as line y=0, y...

Intersecting Two Lines with Varying Angle

So I understand you just want to plot two lines where there is a specific angle between them. If we take one line as line y=0, y...

3 jours ago | 0

| accepted

Answered

Filtering data from a table. How can I save values that are higher that 0.5?

You could get an index for each chunk of data as follows: idx=find(a(:,4)>0.5) idx2=find((idx(2:end)-idx(1:end-1))~=1); idx2=...

Filtering data from a table. How can I save values that are higher that 0.5?

You could get an index for each chunk of data as follows: idx=find(a(:,4)>0.5) idx2=find((idx(2:end)-idx(1:end-1))~=1); idx2=...

4 jours ago | 0

Answered

Map a 2D matrix into 3D using loop for allotment along the 3rd dimension

The best way to deal with that is to use a cell array. I've also just renamed 'end' to 'idxend' and 'i' to 'c' as these are pred...

Map a 2D matrix into 3D using loop for allotment along the 3rd dimension

The best way to deal with that is to use a cell array. I've also just renamed 'end' to 'idxend' and 'i' to 'c' as these are pred...

5 jours ago | 0

| accepted

Answered

Finding the Sum of a Finite Series

Here I just use some examples for x,y and n, and also instead of 'i' I used 'c' as 'i' is designated for complex numbers. c=1; ...

Finding the Sum of a Finite Series

Here I just use some examples for x,y and n, and also instead of 'i' I used 'c' as 'i' is designated for complex numbers. c=1; ...

5 jours ago | 0

Answered

How to rotate surface code

Try the view function (documentation) view(0,0)

How to rotate surface code

Try the view function (documentation) view(0,0)

6 jours ago | 1

| accepted

Answered

Segmenting a vector into multiple vectors based on the time stamps

Hey Masahiro, As I understand it, you have a column vector a_Y, and a second vector hit_idx which provides indices for each seg...

Segmenting a vector into multiple vectors based on the time stamps

Hey Masahiro, As I understand it, you have a column vector a_Y, and a second vector hit_idx which provides indices for each seg...

9 jours ago | 0

| accepted

Solved

Find the Oldest Person in a Room

Given two input vectors: * |name| - user last names * |age| - corresponding age of the person Return the name of the ol...

9 jours ago

Answered

How to solve a plotting problem regarding straight lines

We don't really need all that code to answer the question. It would be much more preferable to just post some sample data. Anywa...

How to solve a plotting problem regarding straight lines

We don't really need all that code to answer the question. It would be much more preferable to just post some sample data. Anywa...

11 jours ago | 0

| accepted

Answered

About simple recursion code

As I understand it you want to find the number of odd numbers from 1 to n. You shouldn't need to write a function for this, you ...

About simple recursion code

As I understand it you want to find the number of odd numbers from 1 to n. You shouldn't need to write a function for this, you ...

11 jours ago | 1

| accepted

Answered

Sum N many of the same array, which are each offset by an integer M

The following should do the job: N = 3; M = 2; % Inputs A_t = [1:N N-1:-1:1]'; %single vector 1,2,3,...,N,...,3,2,1 A = zeros...

Sum N many of the same array, which are each offset by an integer M

The following should do the job: N = 3; M = 2; % Inputs A_t = [1:N N-1:-1:1]'; %single vector 1,2,3,...,N,...,3,2,1 A = zeros...

14 jours ago | 0

Answered

Create multiple sub arrays in one line!

This is one way to go about it: a=strsplit(text(text~=' '),{'(',')'}) output=sprintf('%s',a{:})

Create multiple sub arrays in one line!

This is one way to go about it: a=strsplit(text(text~=' '),{'(',')'}) output=sprintf('%s',a{:})

15 jours ago | 0

Answered

Loop Fuction to keep adding 1

You shouldn't need to write a function for this. I would just define your first x and y, and then n being the length: x1=1; y1=...

Loop Fuction to keep adding 1

You shouldn't need to write a function for this. I would just define your first x and y, and then n being the length: x1=1; y1=...

15 jours ago | 0

| accepted

Answered

How do I determine which row my value change significantly

You could find where data is not equal to 375 and then take the first index where this condition is true: rowstart=min(find(dat...

How do I determine which row my value change significantly

You could find where data is not equal to 375 and then take the first index where this condition is true: rowstart=min(find(dat...

15 jours ago | 0

| accepted

Answered

How to extract values from structure as array and assign numeric values to them?

Assuming that when you load, the name of the variable is data as you mention in the question, then the following should do the j...

How to extract values from structure as array and assign numeric values to them?

Assuming that when you load, the name of the variable is data as you mention in the question, then the following should do the j...

15 jours ago | 0

Answered

(e^(-2x))-2x+1

Here's a plot of the function over the range of x = -2 to +2. x=linspace(-2,2,1000); y=exp(-2*x)-2*x+1; plot(x,y) I used lin...

(e^(-2x))-2x+1

Here's a plot of the function over the range of x = -2 to +2. x=linspace(-2,2,1000); y=exp(-2*x)-2*x+1; plot(x,y) I used lin...

15 jours ago | 0

Answered

How can imfill a objects when they are in the edges of main image?

You could put a border on the image with value 1, then run the filter and remove the border to get original dimensions: I=padar...

How can imfill a objects when they are in the edges of main image?

You could put a border on the image with value 1, then run the filter and remove the border to get original dimensions: I=padar...

15 jours ago | 0

Answered

Removing part of a dimension

Hi Mathijs, If your data is called MRI, then the following should do the job: MRI(:,:,:,logical(OutlierArray))=[];

Removing part of a dimension

Hi Mathijs, If your data is called MRI, then the following should do the job: MRI(:,:,:,logical(OutlierArray))=[];

16 jours ago | 0

| accepted

Answered

Concatenation error during frequency response analysis

Your problem is in these lines because S has 6284 elements: X = det([0 -1/I3 0 0; (H-L^2*I9)/(H) S (2*L^2*I3*I6)/(H*C8) 0; 0 0 ...

Concatenation error during frequency response analysis

Your problem is in these lines because S has 6284 elements: X = det([0 -1/I3 0 0; (H-L^2*I9)/(H) S (2*L^2*I3*I6)/(H*C8) 0; 0 0 ...

16 jours ago | 0

| accepted

Answered

changing value in the center of an array

You could search for the nan value and set it equal to LPF_n0 LPF_n(isnan(LPF_n))=LPF_n0;

changing value in the center of an array

You could search for the nan value and set it equal to LPF_n0 LPF_n(isnan(LPF_n))=LPF_n0;

16 jours ago | 0

Answered

Counting the number of elements surrounding another element.

If your matrix is called A. You could find the number of 0's surrounding an element at A(m,n) as follows: D=padarray(A,[1 1],1,...

Counting the number of elements surrounding another element.

If your matrix is called A. You could find the number of 0's surrounding an element at A(m,n) as follows: D=padarray(A,[1 1],1,...

17 jours ago | 0

| accepted

Answered

Functions Matlab, how to modify?

Hi Jenny, You could write your function to have two outputs as follows: function [Z1,Z2] = test1(d,b,c) % code to...

Functions Matlab, how to modify?

Hi Jenny, You could write your function to have two outputs as follows: function [Z1,Z2] = test1(d,b,c) % code to...

17 jours ago | 0

| accepted

Answered

Solving difficult trigonmetric equations for theta.

polyxpoly works quite well for this situation. I use it here to find the intersection of two lines; your equation (over a specif...

Solving difficult trigonmetric equations for theta.

polyxpoly works quite well for this situation. I use it here to find the intersection of two lines; your equation (over a specif...

19 jours ago | 0

| accepted

Answered

Import data from multiple .dat files, remove headerlines, and read columns into array - but the number of headerlines differs across each .dat file

If 'Dose' appears as the first four elements of this line only, and similarly 'alpha' as the first five of the other line, you c...

Import data from multiple .dat files, remove headerlines, and read columns into array - but the number of headerlines differs across each .dat file

If 'Dose' appears as the first four elements of this line only, and similarly 'alpha' as the first five of the other line, you c...

29 jours ago | 0

| accepted

Answered

Reorganize a table of points based on their coodinates

I put down an index here for sorting the points as you requested. It should do the job. ptstemp=input_points [~,idx(1)]=min(su...

Reorganize a table of points based on their coodinates

I put down an index here for sorting the points as you requested. It should do the job. ptstemp=input_points [~,idx(1)]=min(su...

29 jours ago | 1

| accepted

Answered

How to I locate intervals of time series data, with intervals of data having specific length and similar mean?

If you have a timeseries ts you could do the following (assuming your timeseries is in seconds) idx=ismember(ts.Time,[600:600:l...

How to I locate intervals of time series data, with intervals of data having specific length and similar mean?

If you have a timeseries ts you could do the following (assuming your timeseries is in seconds) idx=ismember(ts.Time,[600:600:l...

29 jours ago | 0

Answered

Getting rid of data that does not meet conditions: Poincare section

You can get your data where x>0 as follows: ND=Data(:,find(Data(1,:) > 0)) % x > 0, for brevity I just call this ND. you can t...

Getting rid of data that does not meet conditions: Poincare section

You can get your data where x>0 as follows: ND=Data(:,find(Data(1,:) > 0)) % x > 0, for brevity I just call this ND. you can t...

environ un mois ago | 1

| accepted

Answered

How to read this file in MATLAB?

You can use the following to read your into a variable D. fid=fopen('silicon_simr1.txt'); fgetl(fid) VarNames=fgetl(fid); st...

How to read this file in MATLAB?

You can use the following to read your into a variable D. fid=fopen('silicon_simr1.txt'); fgetl(fid) VarNames=fgetl(fid); st...

environ un mois ago | 1