Answered
How can I eliminate as many loops as possible from the following code?
I think you cannot get rid of any of the loop. In the loops of the |main| function, you call |rg_traverse|. To omit the loops, i...

9 years ago | 0

Answered
Creating variables consisting of many elements
Or the undocumented function sprintfc: sprintfc('X%d', 1:10)

9 years ago | 1

Answered
Points lying within line
Are the two points meant as end points of a line segement, or just two points on a line, which has infinite length? functio...

9 years ago | 1

Answered
From kron to repmat and reshape
Perhaps: Z = 2; W = 3; A = 5; a = rand(Z, W); b = squeeze(a(:,1)); c1 = kron(b, ones(A,1)) * ones(1,A)...

9 years ago | 0

| accepted

Answered
search multiple results for multiple conditions
for i=1:length(P) dis2 = (P(:,1) - P(i,1).^2 + (P(:,2) - P(i,2).^2; % Omit SQRT() to save time index = secondsmalle...

9 years ago | 0

Answered
how to use waitbar to show file copying status
While it does not matter, that the code is part of a callback, the relevant part is only: copyfile(importpath, exportpath) ...

9 years ago | 1

| accepted

Answered
Can I custum "for" loop for my class instance?
No, this is not valid Matlab syntax: for [key, val] = myClassObj do something; end The |for| command is define...

9 years ago | 0

Answered
create a specific vector from excel file
All I understand from the question is: "0.5 values put only 6 places randomly between 18-24": A1 = zeros(1, 24); inde...

9 years ago | 0

Answered
Differentiating a signal using diff in MATLAB
The result is exact and correct. You can trust the |diff| command. Obviously the signal has a sepcific drift, such that the deri...

9 years ago | 0

Answered
Only 1st of 2 axes in GUIDE updates
function pushbutton1_Callback(hObject, eventdata, handles) [FileName,~]=uigetfile('*.mat','Get File') handles = load(Fi...

9 years ago | 0

| accepted

Answered
Set time reference for incoming samples
Under Windows and Linux see: <https://www.mathworks.com/matlabcentral/fileexchange/16534-high-accuracy-timer> for a high accurac...

9 years ago | 0

Answered
Size of a structure
If you create a struct by the |struct| command, the size of the array is determined by the data, if they are provided as a cell ...

9 years ago | 3

Answered
How to convert data file to audio file
It depends on what a "data file" is. If you mean e.g. a MAT file, which contains a signal as a vector: Data = load('File.ma...

9 years ago | 1

Answered
Problem With Generating M Code From Figures
Do you have any idea, why "waitbar" appears in the message? Is this the toolbox function of Matlab or did you use the same name ...

9 years ago | 0

| accepted

Answered
Remove repeating values from vectors
c = [670; 670; 670; 674; 674; 674; 678; 678; 678]; r = [649; 652; 655; 649; 652; 655; 649; 652; 655]; c = unique(c, 'sta...

9 years ago | 0

| accepted

Answered
passing a file to the timer function
The shown code contains several problems: * You have some variables with an index hidden in the name. This requires to create...

9 years ago | 0

| accepted

Answered
Problem with global variables.
Global variables are a shot in your knee. Again your problem shows, how easy it is to produce confusion using gloabls and how ha...

9 years ago | 1

| accepted

Answered
Is it possible to uninstall previous version of a custom toolbox as part of toolbox installation?
It depends. If the toolbox is stored in a specific folder, you can delete this folder. But perhaps the users modify the M-files ...

9 years ago | 0

Answered
Why can I no longer make an array of this size?
zeros(imagewidth, imageheight, stacknum) creates a 60.5GB array, but casting it *afterwards* requires an additional 15.1GB ...

9 years ago | 2

| accepted

Answered
regexprep replacing two or more variables in a string of text (once) with ',' between them
What is the purpose of the |regexprep| call? Is all you want to do to replace the 4.th line of the file by "300 , 200"? Then: ...

9 years ago | 0

| accepted

Answered
Modify Text File Data in MATLAB
S = fileread('example.txt'); C = strsplit(S, '\n'); for iC = 1:numel(C) aC = C{iC}; comma = strfind(aC, ','...

9 years ago | 0

| accepted

Answered
set axis to follow a formula
With bold guessing: x = rand(1, 10); newx = 12.6 -2.5*log10(x); figure; subplot(1,2,1); plot(x); subplot(...

9 years ago | 0

Answered
How to improve computing speed of in matlab
This is too much code to ask in the forum. It is not clear, which is the "main" file and how the code has to be called. A MAT fi...

9 years ago | 2

| accepted

Answered
Interpolation or resize or what??
I guess boldly: C = {rand(144,196), rand(48,96), rand(113, 204)}; S1 = min(cellfun('size', C, 1)); S2 = min(cellfun(...

9 years ago | 1

Answered
How can I store values from nested for loop in an array?(storing all the values)
I guess, you do not want: array_avg(1,10) = mean(array_poyndb); but array_avg(1, j) = mean(array_poyndb); Creati...

9 years ago | 0

Answered
Matrix dimensions must agree.
Use the debugger to identify the problem. Set a breakpoint in the failing line: Bix = Bix .* sign(MP).* 1000; Then run ...

9 years ago | 1

Answered
Convert cell to time or double
Join the cell string to a string at first, then parse it by |sscanf|: C = {'000:00h:00min:23:743:990µs', '000:00h:00min:23:...

9 years ago | 0

| accepted

Answered
How can i write from txt files to any array
[fid, msg] = fopen('a001.txt', 'r'); if fid == -1, error('Cannot open file: %s', msg); end K = fscanf(fid, '%g ', Inf); ...

9 years ago | 0

Answered
I want to perform certain matrix substraction using vectorization
A = [2,5,7] % Row vector B = [2,7,9].' % Column vector C = A - B % Since R2016...

9 years ago | 0

| accepted

Answered
Real Time GUI hold on not working??
What is |handles.fig0|? If you clear the axes, the formerly drawn elements vanish. Is this wanted? Note: You can simplify the...

9 years ago | 0

| accepted

Load more