A résolu


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

plus de 6 ans il y a

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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 ...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
Create multiple sub arrays in one line!
This is one way to go about it: a=strsplit(text(text~=' '),{'(',')'}) output=sprintf('%s',a{:})

plus de 6 ans il y a | 0

Réponse apportée
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=...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
(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...

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
Removing part of a dimension
Hi Mathijs, If your data is called MRI, then the following should do the job: MRI(:,:,:,logical(OutlierArray))=[];

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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 ...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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;

plus de 6 ans il y a | 0

Réponse apportée
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,...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 1

Réponse apportée
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; ...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 1

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Charger plus