Answered
I want to know the difference between 1 and 1.0000
The output is mimited to 4 digits after the decimal point. Then "1" means 1.0, and "1.0000" means that there is a digit differin...

5 years ago | 1

Answered
switching from 2013b VERSION TO 2020. Accessing figure handle from plot command
No, this did not reply a figure handle in R2013b: ep_hdl=plot(0,0,'Visible','off','Color','k'); The plot command replied a lin...

5 years ago | 0

Answered
Matrix dimension must agree HELP
Are you sure, that you mean the elementwise multiplication and not a matrix multiplication? inv(J1) .* M % Elementwise multi...

5 years ago | 0

Answered
How can I fix this error and what does mean by should return 1 or two arguments help pls
Which userfcn do you provide? You have to insert changes there, so please post the code of your userfcn. It should start with ...

5 years ago | 0

| accepted

Answered
Test equivalence between mex and (.m) matlab functions
I store the compiled MEX functions in a specific folder. This is useful also to support different Matlab version, so each versio...

5 years ago | 1

| accepted

Answered
array of structs how to preallocate and assign
An easy way is to create the struct array backwards: sa = struct([]); for k = 3:-1:1 sa(k).a = k; sa(k).b = rand; e...

5 years ago | 0

Answered
Creating new arrays under conditions.
start = [5000, 7000, 12500, 14200, 19000]; stop = [4500, 8520, 14000, 14500, 21000]; keep = (abs(start - stop) >= 1000); n...

5 years ago | 2

| accepted

Answered
How can I run two loops at a time?
The error message means, that I1(i,j) is a scalar, but smooth(sum(ILP,2)) is not. You cannot assign an array to a scalar. Mayb...

5 years ago | 0

Answered
Automatically open new files as they appear in a folder
Under Windows this canbe done by .NET using a System.IO.FileSystemWatcher. But in general a simple timer is easier: % [UNTESTED...

5 years ago | 0

| accepted

Answered
Early exit instead of a warning in ODE113?
In the current version of Matlab ODE113 does stop, when the integration tolerance is not met. The warning is shown an the integr...

5 years ago | 0

Answered
Merge two saved figures in a single figure
The problem cannot be solved. "Figures" can contain a toolbar, a menubar, GUI elements like buttons and popup menus. If the 2 fi...

5 years ago | 0

| accepted

Answered
Invalid use of operator.
Replace for ii~=jj by if ii~=jj A for command must have the structure: for counter = a:b and the ~= operator is not allowe...

5 years ago | 0

| accepted

Answered
Error Index exceeds the number of array elements (0)
ind = find(segment < 0.5); lock(i) = ind1(ind(1)); If there is no element in segment, which is smaller than 0....

5 years ago | 0

| accepted

Answered
Find indice of floating point number in matrix
find() does not fail on floating point arrays. If a floating point array is provided, find replies the indices of all elements, ...

5 years ago | 0

| accepted

Answered
Building a custom image reader function in MATLAB
It is nearly impossible to write any useful code in Matlab without using builtin functions. See https://www.mathworks.com/matlab...

5 years ago | 1

Answered
convert strings of multiple numbers into matrices
% Contents of the text file: % [[-0.4888 -0.4661 -0.7374 54.5679] % [-0.4835 0.8483 -0.2157 25.8953] % [ 0.7262 0.2511 -0...

5 years ago | 0

| accepted

Answered
How to open a .p file in matlab ?
You cannot "open" a P-file in a meaningful way. Modifications are not possible. If you want to change the code of a P-coded fun...

5 years ago | 2

Answered
Check if a script has been run during this session
Create your own function: function myActivate persistent called if isempty(called) activate(); caslled = true; end...

5 years ago | 1

Answered
Set Path's "Add with Subfolders" functionality
Create your own copy of genpath as mygenpath and insert e.g.: ... if ~strcmp( dirname,'.') && ... ~strcm...

5 years ago | 0

| accepted

Answered
Accessing Subfloders of Subfolders in MATLAB
BaseFolder = 'D:\Your\BaseFolder'; FileList = dir(fullfile(BaseFolder, '**', '*.xml')); for k = 1:numel(FileList) File =...

5 years ago | 0

| accepted

Solved


Calculate cosine without cos(x)
Solve cos(x). The use of the function cos() and sin() is not allowed.

5 years ago

Answered
How can I use the same script for multiple different matrix arrays at once?
% Move the set of variables to fields of a struct: NameList = sprintfc('Y%02d', 0:25); backcd= cd; cd(tempdir); save('dummy....

5 years ago | 0

Answered
How to draw a number of colors from custom colormap?
YourMap = rand(256, 3); % 14 color which exist in the original map: Map14 = YourMap(round(linspace(1, 256, 14)), :); % ...

5 years ago | 0

| accepted

Answered
Import STL file and convert to Matrix
What about using Matlab's STL import? https://www.mathworks.com/help/pde/ug/stl-file-import.html

5 years ago | 0

Answered
How to speed up saving data to .txt file?
fopen, fprintf or even better fwrite is much faster than the very smart writematrix. Appending requires to open the file and sea...

5 years ago | 0

| accepted

Answered
Are Matlab Apps backwards compatible with previous versions
No, the apps are not backward compatible. The users of the apps do need all functions, which are needed by the apps.

5 years ago | 0

| accepted

Answered
Applying a single function to many files in one folder.
See: FAQ: How to process a sequence of files FolderIn = 'D:\Your\Folder'; FolderOut = 'D:\Your\B' FileList = dir(fullfile(F...

5 years ago | 0

Answered
how to remove the error "Dimensions of matrices being concatenated are not consistent."?
I guess, the error occurs in this line: nsegName= ["L5S1","L3L4","T12L1","T8T9","C7T1","C1Head","RT4Shoulder","RShoulder","RElb...

5 years ago | 0

| accepted

Answered
Is it possible to create all possible swaps/permutations within matrix?
A = reshape(1:9, 3, 3); p = perms(1:9); B = zeros(3, 3, size(p, 1)); for k = 1:size(p, 1) B(:, :, k) = reshape(A(p(k, :)),...

5 years ago | 0

| accepted

Answered
Programmatically adjusting editor fontsize does not work
An easier version to set the desktop and editor font immediately: s = settings; % Set temporarily until next start of Matlab...

5 years ago | 0

Load more