Beantwortet
I get Arrays have incompatible sizes for this operation with an elseif statement what do i do?
The == operator compare the arrays elementwise. Therefore the arrays on the left and right must have the same number of characte...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to assign a value to a variable in for loop?
This is the most frequently asked question from beginners. Professional programmers give the simple and not expected answer: Don...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to save all the images generated from the for loop?
Remove the line f=figure; at the bottom of the loop, but open a new figure on top: for i=1:length(fileList) FigH = =figu...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Proper if/else statement in appdesigner
Ref = app.rr_camber_ref.Value; Value = app.rr_camber.Value; if abs(Value - Ref) / abs(Ref) < 0.05 app.Lamp_rr_camber.Co...

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
How do I change the font type in the axes?
Ax1H = subplot(1,2,1); Ax1H.FontName = 'Serif'; Ax1H.FontSize = 15; Ax2H = subplot(1,2,2); Ax2H.FontName = 'SansSerif'; Ax2...

fast 4 Jahre vor | 0

Beantwortet
Match two columns with names/strings that are not 100% identical
Pool = {'NAME123ABC', 'NAME2XYZ', 'NAME3333', 'NAME ZZZ'} Data = {'XYZ', 'Name1ABC', 'abc', '123A', 'AAA', 'ABC ABC', 'Name1 AB...

fast 4 Jahre vor | 0

Beantwortet
Matlab takes long time to start, also it lags so much and windows task manager shows very high memory usage. How to fix this?
Do you really need all toolboxes? This is a massive overkill. You can run the installer again and deselect the toolboxes, you d...

fast 4 Jahre vor | 1

Beantwortet
Processing each data automatically in a loop
If you do not want to call uigetfile, remove this command: pathname = 'C:\Your\Folder'; for i = 0:287 filename = fullfile...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
For loop skipping with if statement
This is a linear interpolation. This is implemented without a loop already: pk = [1, 2; 3, 0; 4, 0; 5, 3; 7, 2; 10, 0; 13, 5]; ...

fast 4 Jahre vor | 0

Beantwortet
How to run a function within another function with specified input?
Convert the scripts S1 and S2 to functions, which accept these inputs. Then: x3 = get(handles.cbS2,'Value'); x4 = get(handles....

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Structure of array: deletion of null elements
S = exp_value; % Just for readability remove = (S.f_avg(:, 1) == 0); fields = setdiff(fieldnames(S), {'f_avg'}); % All...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Naming tables inside a for loop
This is the most frequently asked question in this forum. The answer is easy: Don't do this. It is a shot in your knee. See: TU...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to programmatically delete a folder with content to recycle bin as a whole
Using another folder instead of the recycle bin has severe advantages: The recycle bin fails, if the path name of the deleted f...

fast 4 Jahre vor | 0

Beantwortet
Running Average of a large data set
A = readmatrix(filename); A(:, 3) = movmean(A(:, 2), 101);

fast 4 Jahre vor | 0

Beantwortet
Problems converting folders in a directory from cell array into individual nested structures.
The field names cannot contain a dot. Remove the dots: ... for i = 1:length(subFolderNames) name = strrep(Folders(i).Fold...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to use cumsum function?
loadValue = [0;50;20;10;5;30;12;8;20;30;5]; capacity = 300; mat = capacity(1,:) - cumsum(loadValue); for i = 1:numel(l...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Random lines confined in a 3d box
figure; axes('XLim', [-0.1, 1.1], 'YLim', [-0.1, 1.1], 'ZLim', [-0.1, 1.1]); hold('on'); view(3) nLine = 100; % A cube has ...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to load portions of .dat file
[fid, msg] = fopen(FileName, 'r', 'b'); assert(fid > 0, msg); while true data = fread(fid, [3, 30000], 'uint32'); if...

fast 4 Jahre vor | 0

Beantwortet
How to properly call a function from another matlab-file?
zeros(x1, length(tol)) creates a matrix of zeros with x1 rows and length(tol) columns. If x1 is an integer value, this works. Bu...

fast 4 Jahre vor | 2

| akzeptiert

Beantwortet
Using diff() or gradient() or other methods to solve the local slope of a set of discrete point?
load x.mat load y.mat slope1 = gradient(y); slope2 = diff(y) ./ diff(x); slope3 = gradient(y, x); % Consider x in the s...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Why do I get "Array indices must be positive integers or logical values" error when reading an image?
Did you define "imshow" as a variable? whos imshow which imshow -all To clear it: clear imshow But it is strange, that the ...

fast 4 Jahre vor | 0

Beantwortet
how to add "drawnow" function in it?
The answer is trivial: simply add a drawnow command at the end of the code. But the question remains, what the purpose is. You ...

fast 4 Jahre vor | 0

Beantwortet
Compact way to calculate the centroid of a boundary of a set of points
The centroid of the boundary is the mean value of the coordinates: x = rand(40, 1).^2; % More points on the left y = rand(40,...

fast 4 Jahre vor | 2

| akzeptiert

Gesendet


Rotation Matrix
Rotation matrix in 2D, 3D and N-D

fast 4 Jahre vor | 1 Download |

5.0 / 5

Beantwortet
Rotate Basis Vectors Programmatically
See: FEX: Rotation Matrix This creates N-dimensional rotation matrices.

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to use cumsum function?
CG = 25; C = 0; for i = 1:size(B, 1) if B(i, 5) < 200 if C == 0 C = CG; else C...

fast 4 Jahre vor | 0

Beantwortet
How to speed up this calculation and remove loop(s)?
There is a very small potential for optimizing in the posted code: for row = 1:size(oFD,1) c1 = oFD.PS(row); c2 = oFD...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Access data in cell and save as vector with corresponding variable name
Data = struct(); % [EDITED], was: struct([]); for k = 1:numel(tableCell) C = tableCell{k}; NameList = T.Properties.V...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Vertcat error when concatenating images in loop
vertcat(Sro) concatenates Sro with nothing. What is the purpose of this command? Ask Matlab, what the problem is: for i = 1:le...

fast 4 Jahre vor | 0

Beantwortet
csv file to text file
% [UNTESTED CODE!] function Value = GetCSVElement(File, R, C) % INPUT: File: File name % R: Row index of wanted element. 1 r...

fast 4 Jahre vor | 0

Mehr laden