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...

6 years 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...

6 years 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 ...

6 years 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...

6 years 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{:})

6 years 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=...

6 years 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...

6 years 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...

6 years 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...

6 years 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...

6 years 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))=[];

6 years 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 ...

6 years 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;

6 years 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,...

6 years 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...

6 years 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...

6 years 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...

6 years 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...

6 years 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...

6 years 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...

6 years 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...

6 years ago | 1

Answered
Combination of textarrow and textbox
You could do the following: xtip=0.5; ytip=0.5; % arrow tip coordinates (normalized units) w=0.15; %box width h=0.1; ...

6 years ago | 0

| accepted

Answered
Improving the compactness of code
You could put them in a structure as follows: s.pop=pop; s.gdp=gdp; s.fp=fp; s.lr=lr; and then to run the loop you just itera...

6 years ago | 1

Answered
Finding all numbers which is divisible by 5
This is your answer assuming the while loop is a must: a=input('Enter the threshold: '); disp("Following number is devided by...

6 years ago | 0

Answered
How to concatenate these subplots on one image in matlab?
Hi Gehan, Are the images all the same size and class? If so you can just write concat_img=[V1img;H1img;D1img;A1img]; imshow(c...

6 years ago | 0

| accepted

Answered
Zero padding a 3d structure according to maximum length
Hi Uerm, Lets call your data mycellarray. You can padd the second dimension of all tensors to have the same length as the one w...

6 years ago | 0

| accepted

Answered
How can I compare two cells which consist of the same values, and write the row number of the first to the other file
You actually don't need to run the comparisons. The unique function provides for this directly. So just modify the second line o...

6 years ago | 0

| accepted

Answered
How to find intersection of 2 matrices
There is a handy function for exactly this: [xi,yi]=polyxpoly(x_1,y_1,x_2,y_2); It requires the mapping toolbox which doesnt t...

6 years ago | 0

Answered
Extract Structure element dynamically
I would just convert it to a cell array which is easier to index through as you require c=table2cell(timetable2table(joinedtime...

6 years ago | 0

| accepted

Answered
mmread getting frames of video
To get your 10 frames each second from 0 to N seconds you can do the following (Note though that if you are converting from a st...

6 years ago | 0

Load more