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

fast 5 Jahre vor | 1

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

fast 5 Jahre vor | 0

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

fast 5 Jahre vor | 0

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 1

| akzeptiert

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

fast 5 Jahre vor | 0

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

fast 5 Jahre vor | 2

| akzeptiert

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

fast 5 Jahre vor | 0

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 0

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 1

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 2

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

fast 5 Jahre vor | 1

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 0

| akzeptiert

Gelöst


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

fast 5 Jahre vor

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

fast 5 Jahre vor | 0

Beantwortet
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)), :); % ...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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

fast 5 Jahre vor | 0

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 0

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

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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, :)),...

fast 5 Jahre vor | 0

| akzeptiert

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

fast 5 Jahre vor | 0

Mehr laden