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

5 years ago | 0

| accepted

Answered
Find local min point in plot
clear all; clc; Wavelength = xlsread('Calcite.xlsx','A6:A2156'); reflection = xlsread('Calcite.xlsx','B6:B2156'); % lmin=i...

5 years ago | 0

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

5 years ago | 0

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

5 years ago | 2

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

5 years ago | 0

| accepted

Answered
Load and plot .mat file
x = load('signal1.mat') y = load('signal2.mat') plot(x.x,y.x,'.')

5 years ago | 0

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

5 years ago | 0

| accepted

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

5 years ago | 0

| accepted

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

5 years ago | 0

| accepted

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

5 years ago | 0

| accepted

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

5 years ago | 0

| accepted

Answered
check if numeric field is empty in app designer
Try changing line 117 of app2 (/CurvePlotDropDownValueChanged) to: xlim(app.UIAxes,[app.xMin app.xMax]); Note the xMax was fir...

5 years ago | 0

Answered
How to replace specific values with 0's
A = rand(1435,205); B = A(316:351,146:150) % 36-by-5 sum(B(:)) or: sum(sum(A(316:351,146:150))) or: sum(A(316:351,146:150)...

5 years ago | 0

| accepted

Answered
The image can't be excuted using Imshow function
Is this file: C:\Users\ali.sina\OneDrive - Nude Solutions\Documents\MATLAB\image.m a file you wrote? If so, rename it so that ...

5 years ago | 0

Answered
For loop for string elements and data on a column
%Free Fall clear, clc planet = ["Mercury", "Venus", "Earth", "Moon", "Mars", "Jupiter", "Saturn",... "Uranus", "Neptune",...

5 years ago | 0

| accepted

Answered
How can I reshape single column vector list into equally sized matrix columns
You can't have a matrix with different size columns, but you could fill the last column with NaNs: sample_test = ones(520,1); ...

5 years ago | 0

| accepted

Answered
App Designer: Value for clear all TextArea
You can try any of these commands: app.TextArea.Value = ''; app.TextArea.Value = {}; app.TextArea.Value = "";

5 years ago | 1

Answered
Find index of value extracted from subset in larger set
start_row = 325; end_row = 400; [min_p,min_idx] = min(pvalue(start_row:end_row)); min_idx = min_idx+start_row-1; t = tva...

5 years ago | 0

Answered
Matlab mass pendulum simulation
It appears to ignore the spring and friction forces because s(i) and v(i) are always 0. That is, s(i) and v(i) are calculated af...

5 years ago | 0

Answered
while loop inside a while loop
while true % main while loop % some stuff happens stats = true; playOn = true; while stats...

5 years ago | 0

| accepted

Answered
Save a triangular matrix into a vector and keep track of the position of the values.
Corr = gallery('lehmer',9); % corr mat locationCorr = tril(true(size(Corr)),-1); CorrVect = Corr(locationCorr)'; CorrBl...

5 years ago | 0

| accepted

Answered
i have loop problem
You want to remove outliers by year separately, but it's not clear whether each file corresponds to one year of data or whether ...

5 years ago | 0

Answered
how can i name each ans in a for loop?
You are checking which rows of L have Nb (i.e., 6) in the first column: rowsToSum = L(:,1) == Nb ; Instead you should ch...

5 years ago | 2

| accepted

Answered
this error is always pop up to me (Index in position 1 exceeds array bounds. Index must not exceed 2.)
You have a capital X here: X(3,1)=1/A(3,3)*(b(3)-A(3,1)*x0(1)-A(3,2)*x0(2)) change it to lowercase x: x(3,1)=1/A(3,...

5 years ago | 0

| accepted

Answered
Vertcat of K-shifted vectors
Yes, you can build a matrix of appropriate indices into x (with the first row being shifted once, etc.): N = 100; idx = mod((0...

5 years ago | 0

| accepted

Answered
array did not substitute
y (and x) contains only the most recent input. To keep all inputs, you can do this: count = 0; x=[] Set_data=3 while cou...

5 years ago | 0

| accepted

Answered
How to load numbers from a text file to a .mat file?
You can read the file into a character array called text and save it to a .mat file: % read characters from text file: fid = f...

5 years ago | 0

Answered
Array size limit is exceeded for a matrix of size 85x97
The error happens because when the code gets to this part of the file: [ 85,103]:-5.796e+08 the code reads the first bracket a...

5 years ago | 1

| accepted

Answered
How to align table data to xlim/ylim values
Question: Do any of the first 45 Volumes have a value between 250 and 295?

5 years ago | 1

| accepted

Answered
How to plot data over a desired range in one matrix based on values from a different matrix?
time_limit = [548 5948]; idx = data(:,1) >= time_limit(1) & data(:,1) < time_limit(2); plot(data(idx,1),data(idx,3));

5 years ago | 0

| accepted

Load more