답변 있음
I want compare the differences from each block of 10 values to the next block of 10 values until the given 100 sets of values are compared.
According to the text of the question (but not the posted code): A = rand(100, 1); B = reshape(A, 10, 10); C = diff(B...

3년 초과 전 | 0

답변 있음
Mathlab program solving answr below
Maybe you want to replace for i = 1:n by for i = n:-1:1

3년 초과 전 | 0

답변 있음
Nesting depth and the error "Expected one output from a curly brace or dot indexing expression, but there were x results."
R2022a creates a different error: a(1).x.y=1; a(2).x.y=2; [a.x.y] "instead of just listing all values from across all indexe...

3년 초과 전 | 1

답변 있음
change user name on shared laptop?
Try to start Matlab with a batch script: SET "USERNAME=Test_Name" "C:\Program Files\MATLAB\R2022a\bin\matlab.exe" What do you...

3년 초과 전 | 1

| 수락됨

답변 있음
Intersect() with with repetition
A simple loop approach: A = [1,1; ... 1,1; ... 1,2]; B = [0,1; ... 1,1; ... 1,1]; [C, iA, iB] = Rep...

3년 초과 전 | 1

답변 있음
Create Figures in a loop
fig = gobjects(1, 10); for i = 1:10 fig(i) = figure(); histogram(r(i,:),'Normalization','probability'); xlim([0...

3년 초과 전 | 1

답변 있음
How to use cell indexes into a matrix?
Would this trivial method solve your needs? C = {B(j(1), A{1}); B(j(2), A{2}); B(j(3), A{3}); B(j(4), A{4})}

3년 초과 전 | 0

| 수락됨

답변 있음
How do I return values from figure with out closing the figure
I assume, the calling function is stopped by uiwait? Then closing the function let Matlab resume the processing in the called. B...

3년 초과 전 | 0

답변 있음
Typecast a hex string to single
str = '7f8e2d38'; vec = uint8(sscanf(str, '%2x')); num = typecast(vec, 'single') num = typecast(flip(vec), 'single') % Mayb...

3년 초과 전 | 0

| 수락됨

답변 있음
Making a for-loop based on a condition for the third dimension of a 3D Array
Omit strange useless lines like "for i = i". AntalObjekt = 60; Procent = 0.5; A...

3년 초과 전 | 0

| 수락됨

답변 있음
Repeated measurements of values in a script with repeated trials
Use a loop: st = cell(1, 24); for k = 1:24 st{k} = datestr(now,'YYYY/mm/dd HH:MM:SS:FFF'); ... end

3년 초과 전 | 0

| 수락됨

답변 있음
How can I avoid pseudo random and confirm natural random ?
You can download random bits created by atmospheric noise: https://www.random.org/integers/ An alternative is to install a har...

3년 초과 전 | 0

답변 있음
how to plot multiple curves in same figure
Create a loop: axes('NextPlot', 'on'); % As: hold on ... for daln = 1:5 ... end

3년 초과 전 | 0

답변 있음
extract all values within a if loop to be stored to be used in a figure
The code overwrite SL in each iteration. Store it as a vector instead: SL = zeros(1, Pn) for i = 1:Pn if 0<i && i <= PnC(...

3년 초과 전 | 0

| 수락됨

답변 있음
How to identify two different MACI64 computers
You can create a corresponding preference on each computer: setpref('Computer', 'ID', 'Computer1'); % and on the other machine...

3년 초과 전 | 0

| 수락됨

답변 있음
Script not running for different variable size.
The empty result looks correct: The larger the time, the fewer overlapping slots you find. For Total_Time=1000 there are about u...

3년 초과 전 | 0

| 수락됨

답변 있음
Randomizing the picking and changing of values in a 3D array
x = zeros(24, 365, 60); m3 = randperm(60, 30); for i3 = m3 for i2 = 1:365 m1 = randperm(24, 4); x(m1, ...

3년 초과 전 | 1

| 수락됨

답변 있음
Delete duplicate cell in a cell of complex double.
% Create cell in cell F = cell(1,3); F{1,1} = {[0.04 0.2 0.56; 0.31 0.67 0.22]}; F{1,2} = {[6+6j 7+3j 8-6j; 6+8j 7-6j 3-3j...

3년 초과 전 | 1

답변 있음
Saving in TIF format without losing properties
What about avoiding imwrite but using https://www.mathworks.com/help/map/ref/geotiffwrite.html [tif, tfw] = readgeoraster(tif_...

3년 초과 전 | 0

답변 있음
Sum(sum()) with optimization variable
Constraint2 = sum(x(:, :, (t - pt(j, r)):t), [1, 3]) <= 1;

3년 초과 전 | 0

답변 있음
G-Code Reader not work and say error
The error message tells you, that there have been too many fopen() commands without an fclose() on the computer. If this concern...

3년 초과 전 | 0

답변 있음
Is it possible to get an email notification when a new question is raised?
About 1000 to 3000 Questions are posted in this forum per month. Do you really want to get this pile of mails? Many questions g...

3년 초과 전 | 1

답변 있음
Where/How exactly do I create an ODE Event Location Function?
As Walter has written already, use: [T,Y] = ode45 (@StraightRun, t, y0); % Instead of the old style: % [T,Y] = ode45 ('Strai...

3년 초과 전 | 1

답변 있음
How to store time data separated by colon (e.g 15:59:51:111) as a single data point in a matrix?
Use a table instead of a matrix: Time = datetime({'15:59:51:111'; '15:59:52:098'; '15:59:53:098'}, ... 'InputFormat', 'HH:...

3년 초과 전 | 0

답변 있음
I want to find all order-preserving shuffles of two vectors
3 methods for educational purpose: a = [3,1,1]; b = [4,2]; na = numel(a); nb = numel(b); % Indices of elements of the v...

3년 초과 전 | 0

| 수락됨

답변 있음
how to make this faster?
Some ideas: A = rand(2000, 2000, 5000); B = randi([0,3], 2000, 2000, 5000); tic; A(B==1)=2; toc tic; for k = 1:numel(...

3년 초과 전 | 0

답변 있음
Converting a list of binary numbers to a decimal numbers
Replace load('accumulator_output.dat'); accumulator_output_string = num2str(accumulator_output); by S = readlines('accumulat...

3년 초과 전 | 0

| 수락됨

답변 있음
Can you help me with an error on my GUI program ?
Do not append folders to Matlab path only to import files. This is a source of unexpected behavior. Include only the folders con...

3년 초과 전 | 0

답변 있음
How to preallocate 2D array before for loop?
Do not collect the points, but a list of their indices. If you use logical indexing, you can omit the expensive unique also: n ...

3년 초과 전 | 1

답변 있음
Decrease spacing between plots in matlab
You find many code for modyfying the position of subplots in the FileExchange: https://www.mathworks.com/matlabcentral/fileexch...

3년 초과 전 | 0

더 보기