Answered
Error is getting when median filter is applied to dicom images. The code i am tried is here
This looks, like filename is a cell string, containing file names: info=dicominfo(filenames{1}); Then getting the sizes of the...

5 years ago | 0

Answered
MATLAB suddenly closes when running a complex script
Without seeing the code it is impossible to suggest a solution. There is no magic "do not crash"-flag, which can be enabled by p...

5 years ago | 0

Answered
How to speed up this for loop containing kronecker product?
I get a measureable speedup with reducing the number of sqrt() calls: % Replace D_half = sqrt( diag(S(:,i))); % by D_half = ...

5 years ago | 0

Answered
Load variables from subfolders
I guess, that the loading does not work due to the subfolders? Where is the folder "MATLAB"? Inside your user folder and you ar...

5 years ago | 0

| accepted

Answered
How can I test a long function in Matlab?
You test them the same way as you test short functions: Provide a set with specific input data and compare the results with kno...

5 years ago | 0

| accepted

Answered
How i create a structure from an excell document that i import into matlab ?
What about: T = readtable(ExcelFile, 'ReadVariableNames', true); S = table2struct(T, 'ToScalar', true)

5 years ago | 0

Answered
Calculate the mean value of border pixels in image and minus that from the whole image
img = rand(30, 60, 3); % Assuming RGB images; border = 5; siz = size(img); mask = false(siz(1), siz(2)); mask(1:border, ...

5 years ago | 0

| accepted

Answered
How can I use ode15s with a tspan of two elements?
Why do you assume, that this is a problem? With applying a tspan vectors with >= 3 elements, the integrators of Matlab perform ...

5 years ago | 1

| accepted

Answered
Complex Numbers where thy are not supposed to be
1 - 1^2.5 == 0 % Let's ignore the rounding errors... This is correct. But you calculate something else: x = -1; 1 + x^2.5 ...

5 years ago | 2

| accepted

Answered
Rearrangement of vector elements
Maybe you want: b = rand(1252459, 1); match = false(size(b)); match(1:249:end) = true; match(2:249:end) = true; c = b(match...

5 years ago | 0

Answered
Infinite loop error in moment-curvature diagram program.
I have no idea what your code is intented to do. The missing comments are a serious problem. That all inputs must by typed in in...

5 years ago | 0

Answered
Access/calculate Matrices within a Cell Array
The desctiption of the data as text is less clear than posting some code, which produces example data. With some guessing: All...

5 years ago | 0

Answered
How to create a string array with long strings that continue to a new line?
This is not curious, but the expected behaviour. Matlab inserts commas for separating the elements of a vector automatically. U...

5 years ago | 1

| accepted

Answered
how to call a matrix(1*43) from model to function ?
You can't. rep is the final answer of the integration. Of course you cannot access it before the integration is ready. Please ...

5 years ago | 0

Answered
probleme en gui matlab
Set the code for importing and displaying in the calback of the button. For the details it matters, if you create the GUI by co...

5 years ago | 0

Answered
Find function - scalar result?
Maybe: idx_tol_mot = find(abs(Speed_profil.motorized.time-goal) < 0.001, 1, 'first'); or idx_tol_mot = find(abs(Speed_profil....

5 years ago | 0

Answered
changing variable names when saving variables
Hiding an index in the name of a variable is a shot in your knee. See TUTORIAL: Why and how to avoid Eval A pile of scripts inc...

5 years ago | 0

| accepted

Answered
I want to eliminate the margins of Axes, but it doesn't work.
The "TightInset" includes the tick labels. See https://www.mathworks.com/help/matlab/creating_plots/automatic-axes-resize.html ...

5 years ago | 0

Answered
I need a program to read data from a single file
Omit the brute clearing header: close all clear all clc This is not useful in productive code and I cannot imagine why it is...

5 years ago | 0

| accepted

Answered
Rename of multiple files
SrcFolder = 'C:\Your\Folder\'; DestFolder = 'C:\Your\Converted\Output\'; FileList = dir(fullfile(SrcFolder, 'aaaa*.txt')); %...

5 years ago | 1

Answered
selecting file which name only differs at the end
You list of files does not contain the file extension ".nii", but your code does. This looks confusing. What is the type of sub...

5 years ago | 0

Answered
how do I make a for loop
You are mixing the values of the former step, the current step and the vector of outputs. Without clear comments or an exhaustiv...

5 years ago | 0

Answered
Monitor key press while editing text description in figure
This is not possible with the 'Editing=on' method. Use an edit field instead.

5 years ago | 1

Answered
Rename multiple files in consecutive order
Do the 22 folders have a common base folder? If so: SrcFolder = 'C:\Your\Base\Folder\'; % Parent folder of the 22 folders De...

5 years ago | 0

| accepted

Answered
Importing a "Large (2.5GB)" TIFF file with 'imread' function
The error message means, that filename is a char vector. Then the index {1} would work with a cell string, which would be replie...

5 years ago | 1

Answered
Gaussian elimination using a system of equations, Ax=b
Replace c(t1-d) by c * (t1-d)

5 years ago | 0

| accepted

Answered
Every 1,5,9,13..... marker point should be of same color. Similarly 2,6,10...... and 3,7,11...... and 4,9,12.... should be of same color
x = 1:100; y = rand(1, 100); colorPool = [1,0,0; 0,1,0; 0,0,1; 1,0,1]; figure; axes('NextPlot', 'add'); % Equivalently to...

5 years ago | 0

Answered
mass spring inpulse ode45
Your function to be integrated replies a function handle instead of a numerical vector in some cases: if Forza_spingente(t)>fes...

5 years ago | 0

Answered
Setting lone 1s to 0s in a logical vector/matrix
With FEX: RunLength : a = [0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0]; [val, n] = RunLength(a); del...

5 years ago | 1

Answered
Removing subfolders with same name
BaseFolder = 'C:\Parent\Folder' List = dir(fullfile(BaseFolder, '**', 'Folder B')); List = List([List.isdir]); List(strcmp({L...

5 years ago | 0

| accepted

Load more