Community Profile

# Benjamin

Last seen: Today Active since 2013

All

#### Content Feed

View by

Random sized hexagones in a hexagone grid
The problem is here: Rcore = rand(size(Xh))*range(bounds)+bounds(1); R1core = rand(size(Xl))*range(bounds)+bounds(1); Those a...

31 minutes ago | 0

Error using feval and Invalid function name
You can use an anonymous function, e.g., f = @(x)x/56, or a named function, rather than a character array (f = 'x/56') for feval...

12 hours ago | 0

| accepted

Stopping a for loop when certain values have been reached
values = []; n_tries = 1000; for i = 1:n_tries values(i) = randi(9); if all(ismember(1:9,values)) break ...

12 hours ago | 0

how can i split mtrix to three ?
Here is one possible way, if A is your matrix: A1 = A(1:51,:); A2 = A(52:102,:); A3 = A(103:153,:);

12 hours ago | 0

How do I pass variable from one function to another

13 hours ago | 0

| accepted

Why does my graph come out wrong?
x = -10:0.01:10; y = (x.^2-1).^(2/3); plot(x,y) Note the warning about complex values. The values of y where abs(x) < 1 are c...

1 day ago | 0

circshift function working explanation needed
circshift(s,d) for a vector s and positive integer d shifts the elements of s to the right by d amount, wrapping back to the beg...

1 day ago | 0

| accepted

Taking averages of only a few rows out of several?
A = (1:6).'.*(1:100) mean(A(1:3,:)) mean(A(1:3,:),'all') mean(A(end-2:end,:)) mean(A(end-2:end,:),'all')

1 day ago | 0

delete cell and replace with remaining cells in matlab
If you delete elements from an array (of any type including a cell array) from within a for loop that loops over the elements of...

1 day ago | 0

How do I convert a 3x153 double to a 1x51 matrix?
% Create a 3-by-153 matrix with random data: A = rand(3,153) % Convert the 3-by-153 matrix to a 1-by-51 cell array, with eac...

1 day ago | 0

How to plot the results below ?
Here is something you can try: close all; clear all; clc %Location of the directory Location = 'F:\3-PIV_Experimental_Data\Ou...

2 days ago | 1

How to only extract part of the folder name?
Here is one way: folder_name = 'Run 12-27-56.Adaptive PIV.6uqqm6yu'; folder_number = folder_name(find(folder_name == ' ',1)+1:...

2 days ago | 2

Stract error line 91 and not recognizing the variable
Is something like this what you're trying to do? DataChan1 = importDataChanfile('Data_Chan1.txt'); t=DataChan1{:,1}; % time se...

2 days ago | 1

| accepted

GUI design according to selection of pop-up
If you used GUIDE then, in the GUI's OpeningFcn, you can call your popupmenu's Callback function or otherwise set the visibility...

2 days ago | 0

Remove unwanted text from a .txt file
Original code with output: trace = regexp(fileread('trace.txt'),'^(\d+)\.?\d*:[^:]+:\s+([^\n]+)','tokens','lineanchors'); trac...

2 days ago | 0

| accepted

I can not write piecewise function
sampling=3600; theta_12=linspace(0,2*pi(),sampling+1); T_16 = zeros(1,sampling+1); % idx = theta_12 >= 0 & theta_12 <= 0....

3 days ago | 0

Horizontal concatenate in UItable table
c = readcell('input.xlsx'); c(1,:) = []; idx = ~cellfun(@ischar,c); c(idx) = cellfun(@num2str,c(idx),'UniformOutput',false) ...

3 days ago | 0

How to make pairs of 1s and 0s in an array?
close all clear clc m = 5 %amount of 1s k = 13 %length of array n = k-m %amount of 0s % rhythm_0 = [repelem(0,n)] % r...

3 days ago | 0

| accepted

Find local min point in plot

3 days ago | 0

Generate new file w/ each iteration of for loop. Problem of same output in each new file?
thissample = xlsread('~/Documents/mdd_with_anx.xls'); thissample_size = size(thissample,1); N = 100; if thissample_size < N ...

3 days ago | 0

Time arithmetic (no dates)
datetime(0,0,0,4,30,0) - datetime(0,0,0,2,45,0)

3 days ago | 2

to form a helix spiral
clc R=30; %% radius of curvature W=0.0125; %% width of grating r=10; %% radius of workpiece th_1=(asin(W/R)); %% angle at w...

4 days ago | 0

| accepted

4 days ago | 0

ylim error "Array indices must be positive integers or logical values"
You have a variable called ylim, so the instruction ylim([0 5]) means to get the elements in ylim at index 0 and index 5, which ...

4 days ago | 0

| accepted

Place data within a cell in rows
The attached function may be of some use. t = table(["t = -3.66 p = 0.001 x, y, z = -26.1, -6.2, 52.2 Nvx = 31"; "t = -4.66 p...

4 days ago | 0

How to find the corresponding points of interest on a lat/lon matrix?
S = load('data.mat'); [~,ridx] = ismember(S.updownLon,S.lonMat(:,1)); [~,cidx] = ismember(S.updownLat,S.latMat(1,:)); [n,...

4 days ago | 0

| accepted

reorder on a plot
% Generate random data. In order to be able to distinguish the boxes, make % UpRight have mean 0, DownRight have mean 1, DownLe...

4 days ago | 0

| accepted

Remove Black pixels and averaging the pixels
This will average the non-black pixel values in each channel independently: data = imread('https://www.mathworks.com/matlabcent...

4 days ago | 0

| accepted