Gelöst


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

etwa 6 Jahre vor

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

Beantwortet
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;

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 1

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 1

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

Mehr laden