Answered
How can i edit data in multiple text files?
SortedData = sortrows (Data, -5); n = size(SortedData, 1); Data = SortedData([1:10, 84:s], :); writematrix(FullFileName, D...

5 years ago | 1

| accepted

Answered
Compress down a 1000x1000 matrix into a 100x100 matrix
X = rand(1000, 1000); Y = reshape(X, [10, 100, 10, 100]); Z = reshape(sum(sum(Y, 1), 3), [100, 100]) / 100; Or with FEX: Bloc...

5 years ago | 0

Answered
Producing a NaN only where there is a NaN, zero otherwise
X = [-inf, -1, -eps, 0, realmin, 2, 1+i, pi, flintmax, realmax, inf, NaN]; V = [0, NaN]; F = @(X) V(isnan(X) + 1); F(X)

5 years ago | 1

Answered
how to plot f(x,y) = x^2/y, y>0
x = linspace(-10, 10, 100); y = linspace(0, 10, 100).'; f = x .^ 2 ./ y; surf(x, y, f)

5 years ago | 0

Answered
Find and replace empty element in text file
S = fileread(FileName); S = strrep(S, char(13), ''); S = strrep(S, char(10), ' '); C = strsplit(S, ' '); C = strrep(C, ' ', ...

5 years ago | 0

Answered
Get Windows taskbar height
You can move the taskbar to the side and to the top, hide it dynamically and change the size. The static determination of the he...

5 years ago | 0

| accepted

Answered
Finding the height of windows taskbar
You can move the taskbar to the side and to the top, hide it dynamically and change the size. The static determination of the he...

5 years ago | 0

Answered
How to generate a 1D array of zeros in Matlab?
Please read the Getting Started chapters of the documentation and Matlab's Onramp: https://www.mathworks.com/learn/tutorials/mat...

5 years ago | 2

Answered
how can ı write this one?
S = repmat('*', n, n) % A square % Or: S = ''; S(1:n, 1:n) = '*'; For a square, you have to set the elements (2:n-1, 2:n...

5 years ago | 0

| accepted

Answered
My script is working wrong with nested for loops
Plotting the line does not need a loop: % for b = 0:0.5:a % The body does not depend on b, so omit the loop plot([0, a, ...

5 years ago | 0

Answered
How to append value to matrix after calling from function?
Result = cell(1, 100); for k = 1:100 Result{k} = call your function end If the output is a scalar double in all cases, us...

5 years ago | 0

| accepted

Answered
How can i change variable name by code???
rename variable B to C: C = B; I'm afraid you want top do something else: Creating a variable with a dynamically determined na...

5 years ago | 0

Answered
Get values from complex struct
"I want to search the A.B.C structures for var_a = x" - this is not clear yet. "I tried "find", but I get "Reference to non-ex...

5 years ago | 0

| accepted

Answered
Compose Large Matrix of smaller matrices
The naive solution: A = cell(1, 10000); % Create test data for iA = 1:numel(A) A{iA} = rand(10, 15); end siz = size(A...

5 years ago | 1

| accepted

Answered
Can you help me to get this solved
xn=xu-(f(xu)*(xl-xu)/(f(xl)-f(xu))); xnOld=xn; e=((xn-xnOld)/xn)*100; Now xn and xnOld are the same number and xn-xnOld is 0 ...

5 years ago | 0

Answered
How to create a new vector from another vector which contains the value times the index
v1 = [5,4,3,1]; v2 = []; for i = 1:length(v1) for j = 1:v1(i) v2 = [v2, i]; end end You can omit the inner...

5 years ago | 1

| accepted

Answered
How can i do that?
a = input('Bir sayi giriniz='); figure; axes('NextPlot', 'add', ... % as: hold on 'XLim', [-1, a+1], 'YLim', [-1, a+1],...

5 years ago | 1

| accepted

Answered
imwrite on remote desktop
The observation is correct. getframe does not work outside the visible area of the screen. So this is not a problem of imwrite. ...

5 years ago | 0

| accepted

Answered
find prime numbers between 1 to 100
You got a valuable hint already, that nested loops are useful: for k = 1:100 for f = 2:100 % Now check if f is a di...

5 years ago | 0

Answered
Normally distributed Random numbers generator issue
This is a perfect normal distribution of 500 values. With such a small set of data, a lot of noise is expected. Otherwise it wou...

5 years ago | 1

Answered
Invalid handle Error in Saveas command
Do not shadow the built-in function "gca". The first output of specgram is y, not the figure handle. If you want to get the ha...

5 years ago | 0

| accepted

Answered
Maximum absolute value in array
Use the 2nd output of the max() command: [Bymax, index] = max(abs(By)) By(index)

5 years ago | 1

Answered
Obtaining how many times a number is repeated (Matlab)
Do not use indices hidden in the name of the variables, but indices of arrays: B{1} = [1,2,5,6,7,8]; B{2} = [1,3,4,6,8,10]; B...

5 years ago | 0

Answered
If loop issue help
The if command is not a loop. It requires a scalar condition. You provide vectors, so Matlab inserts an all() automatically. Th...

5 years ago | 0

Answered
Error while opening matlab GUI and input images at start ( matlab 2017b)
Do not use "try" as name of a function, because this is a built-in keyword. The actual error message tells you, that the file "...

5 years ago | 0

Answered
saving data from text file which meets conditions
xyData = ('ANNDB1.txt'); Now xyData is the char vectpr 'ANNDB1.txt' . I guess, this is a file name. Then you have to import th...

5 years ago | 0

Answered
check for a pair in power hand
The trivial approach would be two nested loops: card = randi(20, 1, 1000); result = zeros(2, numel(card)); % Pre-allocate ...

5 years ago | 0

Answered
Using Set() to change data in a figure to a matrix
a = [1 3; 4 2]; b = [1 2; -5 -2]; graph = plot(a, b); pause(1) % Only to see the changes set(graph, {'xdata'}, mat2cell(b, [...

5 years ago | 1

| accepted

Answered
saveing SVG from figures
Try to set the renderer of the figure to Painters. The OpenGL renderer creates pixel graphics.

5 years ago | 1

| accepted

Answered
No matter what I try, I cannot get these plots to come up in separate figure windows.
"There are probably ways to read a text string from the web and pass it directly through CSV tools rather than looping as I had ...

5 years ago | 0

Load more