Answered
Removing rows that are not unique from an array?
As = sortrows(A); k = find([true; any(diff(As, 1, 1), 2); true]); B = As(k(diff(k) == 1), :); And if the original o...

9 years ago | 1

Answered
Dear all please help me to list permutations with repitations of the numbers 1,2,3,4 of length 9. One of the output is 1 2 3 4 2 3 4 2 1
With <https://www.mathworks.com/matlabcentral/fileexchange/26242-vchoosekro FEX: VChooseKRO> Result = VChooseKRO(1:4, 9) ...

9 years ago | 0

Answered
Help regarding For loop
z = zeros(1000, 22); x = rand(1000, 22); lamda = rand(); for k = 2 : 1000 z(k, :) = lamda * x(k, :) + (1-lam...

9 years ago | 0

| accepted

Answered
How to efficiently find the index cell-string and cell-number?
This does not work: index2 = find([raw{:,7}] == 1); The first element |raw{1,1}| is the string 'Trial'. Therefore |[raw{...

9 years ago | 1

| accepted

Answered
How to reset variables in MATLAB GUI?
It depends on what "delete" means. You do not create variables by the |setappdata| command, but this function stores the con...

9 years ago | 0

Answered
How to clear the former command
|clc| does not clear "the input", but the output to the command window. This might look nitpicking, but the difference might con...

9 years ago | 0

Answered
convert cell array into double and remove dollar symbol
C = {'$12,001.87','$0.04','$12,003,887.55','$0.32'}; C = strrep(C, '$', ''); C = strrep(C, ',', ''); N = str2double(C...

9 years ago | 2

| accepted

Answered
Dir function only works intermittently?
This sounds magic. Matlab is a deterministic programming language, which is not too lazy to read 40'000 files when it is instruc...

9 years ago | 0

Answered
How to remove the black outlines when using 'image' command to display a image.
I = ones(1,1,3); I(:,:,1) = 255; I(:,:,2) = 255;I(:,:,3) = 0; AxesH = axes('Visible', 'off', 'NextPlot', 'add'); imag...

9 years ago | 0

| accepted

Answered
How to make a slider GUI with most simple code
* Why it cannot run normally when I drag the slider? This is "normally". The code is using the Callback currently, which is t...

9 years ago | 2

| accepted

Answered
how to add values to an array from a loop
The purpose of the loop over i is not clear. A meaningful comment would calrify this. Do not let the readers in the forum guess,...

9 years ago | 1

| accepted

Answered
I need to generate a GUI that displays a random number between 0-10000 everytime "Button" is pressed
function YourGUI FigH = figure('Name', 'Your GUI', ... 'IntegerHandle', 'off', ... 'MenuBar', 'none', ... ...

9 years ago | 1

| accepted

Answered
Deleting plots within a GUI only if the plot exists?
Perhaps S is your handles struct? Then: function deleting_plots(source, eventdata) S = guidata(source); if ishghanlde...

9 years ago | 0

Answered
Fprintf: how to automatically move to a new line when reach end of screen?
It does not only depend on the size of the command window, but on the font also. It matters if it is a fixed-width or proportial...

9 years ago | 1

Answered
How can I store the values "Ergebnis" form every loop into a big Matrix?
ErgebnisC = cell(1, 41); % Pre-allocate! for t = 0:40 ... ErgebnisC{t+1} = [Kapa opt_Preisentscheidung max_erwar...

9 years ago | 0

Answered
Moving files via current folder window.
If I copy&paste a file in the windows explorer, it is duplicated and this is what I expect in folder views also, e.g. in the fil...

9 years ago | 0

Answered
Expected a scalar. Non-scalars are not supported in IF or WHILE statements...?
Please post the *complete* error message. Currently it does not contain the information which line causes the problem. Note t...

9 years ago | 0

Answered
Best/most accurate timer function?
It depends on which resolution you want to achieve. I would not trust Matlab's tic/toc for less than 0.01 seconds. But instead o...

9 years ago | 0

Answered
command to read all current pressed keyboard keys
Did you try: <https://de.mathworks.com/matlabcentral/fileexchange/30622-non-wait-detection-of-keyboard-input--including-mex-impl...

9 years ago | 0

Answered
Save values of for loop inside matrix
The shown code cannot work: A1 = data(p0:p4,:); A2 = [data(p0:p3,:); data(p4+1:p5,:)]; A5 = data(p1+1:end,:); tabl...

9 years ago | 0

Answered
find matrix in cell matrix
index = []; for k = 1:numel(C) if iseuqal(C{k}, test_matrix) index = k; break; end end Or i...

9 years ago | 1

| accepted

Answered
Why does Matlab crashes between mex calls?
The asnwer is easy: One or more of the called Mex functions copntains a bug. This happens frequently, because C-code is very sus...

9 years ago | 0

| accepted

Answered
Faster codes in a loop
Are you sure that ROEpeer and ROApeer is pre-allocated properly? isnumROE = ~isnan(ROE); isnumROA = ~isnan(ROA); for ...

9 years ago | 0

| accepted

Answered
Is it possible to rotate the data inside each cell of a cell array
While C = cellfun(@rot90,C,'uni',0) creates a copy of C, such that the double size of memory is required temporarily, a...

9 years ago | 1

| accepted

Answered
Global variable not seen by function: the function creates a new empty variable
While I agree, that globals should be avoided, you code should work: function main global T T = something ... ...

9 years ago | 1

Answered
Extracting phase information of a signal buried in noise using FFT
See the many examples in the net to interprete the output of FFT, e.g. <http://www.gaussianwaves.com/2015/11/interpreting-fft-re...

9 years ago | 0

| accepted

Answered
How to read date and time of a file?
How are the names available? Do you have them in a cell string already or do you want to grap them by |dir|? If you have the ...

9 years ago | 0

| accepted

Answered
strcmp isn't comparing properly
Of course |strcmp| works fine. If you do not get the expected result, the inputs differ from what you think they are. This can b...

9 years ago | 1

| accepted

Answered
How to populate a cell array with vector elements?
What have you tried so far? This is easy with a loop: C = {ones(1, 3); ones(1, 7); ones(1, 5)}; x = [3; 5, 7]; for k ...

9 years ago | 2

| accepted

Answered
How can I show a .txt composed with data on a edit in GUI?
What about: Str = fileread(file); CStr = strsplit(Str, '\n'); set(handles.edit1, 'Max', 2, 'string', CStr); This ...

9 years ago | 0

Load more