Answered
Access and write data variables from function in using function?
Please read this carefully: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-d...

6 years ago | 0

Answered
Speeding up code which integrates a 2D gpuArray matrix using Simpson's Rule
These are faster at least on CPU - I do not have graphics hardware in my laptop which supports GPU arrays: function I = simpson...

6 years ago | 1

| accepted

Answered
How to extract variables within a ODE function?
The standard method is to add them to the outputs and call the function to be integrated for the time steps afterwards: functio...

6 years ago | 0

Answered
im2uint8 only generates 0 or 255
im2uint8 expects the input to be an RGB image, which is a 3D array with values from 0 to 1. So normalize your data at first by ...

6 years ago | 1

| accepted

Answered
How to delete duplicate values from an array or a vector
b=[1 1 3 3 4 5 4 9 1]; % The clean solution: b = unique(b(:).') % [1 3 4 5 9] % Without unique: bs = sort(...

6 years ago | 1

| accepted

Answered
Plot on many figures using cellfun
CELLFUN is not really useful here, because it increases the complexity. Do this with a loop instead: t = {rand(1,10),rand(1,10)...

6 years ago | 1

| accepted

Answered
How to write multiple outputs to a .txt file?
string_outp= [string(app.file_geo), "from", ... string(from_value), "to", string(to_value), ".geo.txt"]; output_...

6 years ago | 0

| accepted

Answered
Derivate a signal with staircase
A Savitzki-Golay-filter might be sufficient for your data: The local neighborbood is approximated by a polynomial, such that the...

6 years ago | 0

Answered
incremental sum in array
A = [45 48 63 84 32] cumsum(A, 'reverse')

6 years ago | 0

| accepted

Answered
GUI login page in matlab
Maybe this helps: https://www.mathworks.com/matlabcentral/answers/15789-asking-for-a-password-or-code#answer_21434 https://www...

6 years ago | 0

Answered
Search/Find sub strings in a string
KeyList = {'Ra', 'Bt', 'Rag', 'Rg', 'Vm', 'SzF'}; StringList = {'F.y_1T.Rg1_N7', 'F.y_1T.Ra1.SzF2_N590', ... ...

6 years ago | 0

Answered
Solve ODE with a time dependent parameter
Remember that Matlab's ODE integrators are designed to operate on smooth functions. The hard jumps of the parameter will confuse...

6 years ago | 1

Answered
How to change a given name
num = '0000060' folder = ['C:\Users\dit\Documents\MATLAB\RawData\', num, '.csv']; % Or with strings instead of char vecto...

6 years ago | 1

Answered
Extract numeric data from cell
A = ['position: [0.5418702363967896, 0.0005752428551204503, ', ... '-3.834952076431364e-05, 0.0, 0.0, 0.0]']; D = extractB...

6 years ago | 0

Answered
String operations on dynamic dataset
w=[ "Mac_A" "1 9:53.3" "2 9:23.5" "3 2:16.2" "4 2:45.6" "5 12:01.2" "Mac_B" "1 23:56.5" ...

6 years ago | 1

| accepted

Answered
how to find and replace a number/word/command in all opened *.m files in matlab at once?
If the files are located in the same folder, grepWin can do this for you in Windows: https://tools.stefankueng.com/grepWin.html ...

6 years ago | 0

| accepted

Answered
runge kutta method for differantial equations systems
y0 = [1, 2]; [T, Y] = ode45(@OdeFcn, [0, 0.1], y0); plot(T, Y); function dy = OdeFcn(t,y) dy = [(10 * sin(314 * t) - 5 * y...

6 years ago | 1

| accepted

Answered
Import file from subfolders
Folder = cd; FileList = dir(fullfile(Folder, '**', 'A.txt')); A = cell(1, numel(FileList)); for iFile = 1:numel(FileList)...

6 years ago | 0

| accepted

Answered
runtime load mat-file not proportional to size?
Do you saved in compressed or uncompressed format? In v6, v7 or v7.3 style? Is the file contained in the disk cache of your HDD...

6 years ago | 0

Answered
how create matrix 8*8
Your code does not produce unique values. To obtain uniqueness the 8*8 elements must contain the values from 0 to 63: v = 0:6...

6 years ago | 1

| accepted

Answered
How to adjust the size of image in subplot?
Simply resize the figure with the mouse. Or define the size of the figure in the code using the 'Position' property. Alternative...

6 years ago | 1

| accepted

Answered
How to remove (or reshape) singleton dimensions in cell array?
The FOR loop is the simplest and fastest method. I do not see a reason to avoid it. But if you really want to: C = cellfun(@(x)...

6 years ago | 0

| accepted

Answered
How to extract values from columns in a matrix
H=[2 0 0 0 0; % Smarter test data with 0 3 0 0 0; % specific values on diagonal 1 1 4 0 0; 1 0 1 5 0; 1 0 1...

6 years ago | 1

| accepted

Answered
How to write a for loop code with an undetermined value
Is there a reason to collect NNN in an array? for i = 1:NN_length NNN = (N == NN(i)); % Without FIND: faster logical in...

6 years ago | 1

| accepted

Answered
Mid point value of a function
interval is [0,1] with n subintervals and I need to find the sum of the function at midpoint of every subinterval. n = ...

6 years ago | 0

Answered
How do you name single output functions?
I use CamelCase for my funtions to reduce the danger a collision with toolbox functions of Matlab. For frequently used functions...

6 years ago | 0

| accepted

Answered
How to get the answer of atan(tan(9*pi/4)) as 9pi/4 and not as pi/4?
You can't. Remember, that tan() is a periodic function. Then tan(x) replies the same value as tan(x + 2*n*pi) with integer n. Ap...

6 years ago | 0

Answered
Shuffle identical values of an array together
A = [1 9 6 2 10 8 3 8 11 7 5 5 6] B = [1 2 2 1 1 1 1 1 2 2 2 2 2] uB = unique(B); nuB = numel(uB); uB = uB(randperm(nu...

6 years ago | 1

| accepted

Answered
How to convert standard form to decimal notation?
format long g

6 years ago | 1

Answered
fgetl gets stuck in infinite loop
while(isempty(strfind(line,'A_z'))) line = fgetl(fid); end This code stucks in an infinite loop, if a file does not conta...

6 years ago | 1

Load more