Community Profile

# Sindar

##### Last seen: 5 dagen ago

281 total contributions since 2018

View details...

Contributions in
View by

Find the equality of each value in the vector and cell array
% better test data A = {1;[];1;[1 4];3}; B = [1;4;10;4;3]; temp = zeros(length(B),1); for i=1:length(B) % isequal handl...

19 dagen ago | 0

| accepted

Overwriting information in a cell array
Braces access cell contents, allowing you to update (in this case, appending to the end and hoping it's a compatible shape) Bra...

19 dagen ago | 0

| accepted

Simulate single sine wave
Without the noisy signal? See sin documentation. With the signal (i.e. fitting to it), check out the answer to this question

19 dagen ago | 0

How can I fix "Index in position 2 exceeds array bounds" in for loop/ if statements?
Okay, I believe this code is equivalent to what you have, cleaner and without the error % pre-allocate with cell arrays of [] ...

22 dagen ago | 0

| accepted

This is function to help
Whether this can be vectorized is really a question about SD. It's possible it works on columns straight off: Val = SD(VImage,Q...

23 dagen ago | 0

What is missing from MATLAB #2 - the next decade edition
Ok, this is pretty minor, but: For common functions that return values as the first output and indices as the second, it would ...

23 dagen ago | 0

Indices of 2D array
data =[ 2 5 0 15 12 7 4 8 19 14 20 25 18 13 40 ]; reshaped_data = reshape(data,3...

23 dagen ago | 1

| accepted

Potting graphs with if else and for
If it throws an error, please include that information. If that error is what I'm seeing: Error using plot. Vectors must be th...

23 dagen ago | 0

| accepted

extracting information from tall timetable using a loop
Looks like you could do everything with groupsummary, assuming you can figure out how to define the bins G = groupsummary(TT,'T...

27 dagen ago | 0

| accepted

Trying to create a matrix by nesting a for loop in another for loop
No need for loops, except if effectiveness doesn't accept arrays % nx1 NTU = (2.5:0.1:3.5).'; for i=1:length(NTU) eff(i)...

27 dagen ago | 0

| accepted

Faster Looping for Griding/Binning Data
check out discretize

27 dagen ago | 0

How to plot phase and amplitude spectrum after doing fft?
See this example for in angle documentation

27 dagen ago | 0

Convert from cell of a table to an array
It gets tricky with different variable types and widths, but hopefully this helps. Worst case, you build up the new table elemen...

29 dagen ago | 0

| accepted

CREATE HISTOGRAMM WITH A SPECIFIC NUMBER OF CLUSTERS IN X AXIS
histogram: x = randn(1000,1); nbins = 5; h = histogram(x,nbins)

ongeveer een maand ago | 0

Z must be a matrix, not scalar or vector - SURF
struct array is a terrible way to store this data. Does this do it? tbl = struct2table(b); surf(tbl.temperature,tbl.humidity,t...

ongeveer een maand ago | 0

| accepted

Projectile motion using while loop Time of flight
Basically, the issue is that you are only updating a small portion of the relevant variables each time step. A few questions Is...

ongeveer een maand ago | 0

| accepted

plotting a function correctly
x=[-2:0.1:2]; y = exp(-x)-x; plot(x,y)

ongeveer een maand ago | 0

| accepted

what is the code for bin histogram of fraction to the bin
You can specify the histogram edges like this, with the height of the bars normalized to %: x = randn(1000,1); edges = 25:5:50...

ongeveer een maand ago | 0

Plotting Phase angle in Matlab
First off, "load" is for Matlab files, not raw text. Check out textscan. If your code isn't error-ing, you probably have old ver...

ongeveer een maand ago | 0

Change histogram to more bars
histogram accepts the number of bins as a second argument: x = randn(1000,1); nbins = 25; h = histogram(x,nbins)

ongeveer een maand ago | 1

| accepted

What is this code doing?
Short version: copy a list of Matlab script/function files from wherever Matlab finds them into a particular directory ('C:\TEMP...

ongeveer een maand ago | 0

| accepted

Extracting data from an array
To extract the first three rows: B3 = B(1:3,:); x = B3(1,:); y = B3(2,:); z = B3(3,:); But, if B is really 4x1, then you on...

ongeveer een maand ago | 0

can anyone find the error?
Perhaps you are calling the function with two few arguments, such as this on the command line: quadraticc(2) If you are simply...

ongeveer een maand ago | 0

| accepted

Sort and extract elemets from a structure.
tables are a vastly superior way of handling this data. Does this do it? mydata= readtable('mytext.txt'); sorted_data = sortro...

ongeveer een maand ago | 0

| accepted

How to extract values from each structure in the .mat file
keeps the names, but as fieldnames in a new struct, signals, rather than variables (see Walter's comment): data = load('data.ma...

ongeveer een maand ago | 1

| accepted

Changing the size of an array in a while loop
keeps the vector the same length A_i = gradient(A_0,dt).*I.^2; changes size of vector (and uses a for loop since there are a...

ongeveer een maand ago | 0

| accepted

I have the following Matlab code that produces a x2 zoomed image of the input using Pixel Replication. How can I change it to shrink an image?
throw out every other row and column: img1 = imread(filename); N = img1(2:2:end,2:2:end);

ongeveer 2 maanden ago | 0