답변 있음
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...

3년 초과 전 | 0

답변 있음
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...

3년 초과 전 | 1

답변 있음
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...

3년 초과 전 | 0

| 수락됨

답변 있음
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]; ...

3년 초과 전 | 0

답변 있음
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....

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 0

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

3년 초과 전 | 0

답변 있음
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...

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 0

| 수락됨

답변 있음
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 ...

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 0

답변 있음
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...

3년 초과 전 | 2

| 수락됨

답변 있음
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...

3년 초과 전 | 0

| 수락됨

답변 있음
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 ...

3년 초과 전 | 0

답변 있음
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 ...

3년 초과 전 | 0

답변 있음
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,...

3년 초과 전 | 2

| 수락됨

제출됨


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

3년 초과 전 | 다운로드 수: 5 |

5.0 / 5

답변 있음
Rotate Basis Vectors Programmatically
See: FEX: Rotation Matrix This creates N-dimensional rotation matrices.

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 0

답변 있음
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...

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 0

답변 있음
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...

3년 초과 전 | 0

답변 있음
loop over variable with different characters
This shows, that you have created a bunch of variables and stored important information in the name of the variables. This desig...

3년 초과 전 | 0

| 수락됨

답변 있음
Efficient way to assign indices to variables in a matrix
[~, Result] = ismember(A, B(:, 4)); A look up table is even faster: Instead of searching the element A(i,j) in B(:, 4), create ...

3년 초과 전 | 1

답변 있음
Why sprint doesn't show a zero value from an array?
Reduce the clutter: a=[1:450:2251]; % Easier: a = 1:450:2251; [] is Matlab operator for a concatenation. [1:450:2251] concat...

3년 초과 전 | 0

| 수락됨

답변 있음
How to interleave data from 2 doubles of differing length?
A=[1420;2956;4492;6028]; B=[2960;3152;3344;3536;3728;3920;4112;4304;4496;4688;4880;5072;5264;5456;5648;5840]; [C, idx] = sor...

3년 초과 전 | 0

| 수락됨

답변 있음
Load multiple *.mat files and save outputs using loop without overwriting the previous file
filePattern = fullfile(myFolder, '*.mat'); theFiles = dir(filePattern); nFiles = numel(theFiles); % not size() Out = cell...

3년 초과 전 | 0

| 수락됨

더 보기