Community Profile DGM

Last seen: Today Active since 2015

Hi, I'm nobody.
I don't belong here, but I have nothing better to do.
Matlab used to be part of my work.
Now it's part of my hobbies.

Statistics

All
• • • • • • • • • • • • Content Feed

View by

Is it possible to eliminate a color range from certain colormap?
Old, I know ... If you want to break the circularity of hsv(), you can do so by doing the interpolation yourself: z = peaks(10...

20 hours ago | 0

how to sum each element in vector
a = 1:1:10; % you could do it with a loop s = zeros(1,numel(a)); s(1) = a(1); for i = 2:numel(a) s(i) = s(i-1) + ...

23 hours ago | 0

how can I break up a number into its separate digits
I'm sure I've seen more elegant ways, but off the top of my head, I don't remember. EDIT: ... oh. I'm assuming we're talking a...

24 hours ago | 0

| accepted

Generate a numerical series
This is one way: k = -8:-1:-14; v = 10.^k fprintf('%g\n',v.') % for sake of clarity

1 day ago | 1

*.* and %s meaning in MATLAB
In an expression like v = 'words'; fprintf('this is a progression of several %s\n',v) %s specifies "string or character vect...

1 day ago | 0

| accepted

i have create a program that it will loop back if input y , but if user input other value, still will end the program . how can i restricted the value just y and n
This might do what you need. selectarea = true; while selectarea area = input('Please select area (kitchen, bathroom or s...

1 day ago | 0

How do I prevent my code from printing the ans statements?
% this is equivalent to what you wrote for k = 2 % these are all individual statements 3 4 5 X = randi([0,1...

1 day ago | 0

| accepted

Plot a 3D map surface with xyzz, where I want one of the z-axis to be the color bar and the other 3 variables to be the axis
If I'm understanding this correctly: A = [0.1846 400 0.42 12; 0.1846 500 0.42 13.9; 0.1846 600 0.42 15.7; 0.4 50...

1 day ago | 0

| accepted

how to exclude some value from matrix?
It's unclear whether you want to exclude A(1,3) or whether you want to exclude the number 3 regardless of its location. A = [1 ...

1 day ago | 0

| accepted

file path issue in matlab
uigetfile() doesn't do anything but return a filename. It doesn't matter where the file is or whether it's on the ML path. It ...

2 days ago | 0

| accepted

Plot a regular pyramid using given Cartesian coordinates
X = [0 1 0.5 0 0.5 1 0.5 0.5]; Y = [0 0 sqrt(3)/2 0 1/sqrt(3)/2 0 sqrt(3)/2 1/sqrt(3)/2]; Z = [0 0 0 0 sqrt(2/3) 0 0 sqrt(2/3)...

2 days ago | 1

| accepted

How to slice an RGB image in CIE L* ranges?
Here's an example of some concepts. I'm just attaching the files instead of trying to paste them. The RTE is buggy and likes t...

2 days ago | 0

| accepted

How can i code for problems which have range
I'm not sure if this is exactly where you're going with your example, but let's say you have a vector and you want to print a me...

3 days ago | 0

| accepted

Getpts with SnapToDataVertex on?
I wouldn't expect datacursor settings to affect anything other than datatips. Nothing in the documentation suggests it should a...

3 days ago | 0

Plotting a parabola and an ellipse on the same graph
It's not being ignored; it's just so tiny that you can't see it. Change the domain over which you're plotting. x = linspace(-1...

3 days ago | 0

| accepted

How do I create a (10,10) matrix containing numbers from 1 to 100?
If we're posting solutions which are instructive, even if not ideal: A = zeros(10); A(:) = 1:100; A = A.'

4 days ago | 0

where is the mistake?
If you want it to do what your code implies: w = 'a4jkltr6mramlkrffgajr'; oo(w) function oo(w) if isstring(w) % string...

4 days ago | 0

How do we shift the cell of a variable and replace it by NaN?
It depends what you mean by "shift". Consider the two examples: x = 20:20:200 a = [NaN(1,5) x] % simply concatenate b = [NaN...

4 days ago | 0

| accepted

How do I rename the .mat files in a for loop?
Since your filenames all have variable-length numbers in them, they won't sort like you expect. If you've already run this code...

4 days ago | 0

| accepted

How can I turn the elements of a cell array into a bar graph?
Here's a start. This will space all the bars evenly, regardless of the date spacing: % create example array t = num2cell(date...

4 days ago | 0

what does the "-1" means in conditional statement?
Entering the if structure isn't conditional on -1, it's conditional on whether SimGlobal.aSatData(i).sOrbitData.sEphData.PRN is ...

4 days ago | 0

| accepted

How to remove the number 0 between index1 & index2 ?
Assuming that you're only concerned with zeros between 1 or 2, and that all values are single-digit numbers, here's one way: A ...

4 days ago | 0

How to plot different y values for different x values, provided the x and y values are to be generated in a loop?
This is a start: n=100; b=6.9; r=5; y=(r-1)+0.5; e=0;z=2; U=9000; npoints = 500; a = linspace(4500,U,500); q = 2*pi*a...

4 days ago | 0

| accepted

Is it possible to change the background color of data tips?
@Ankit is correct. There really aren't any such color properties for datatips. If you like frustration, you can always craft...

4 days ago | 0

Please write a script for summation of 1/k
I don't see why the code you wrote wouldn't work. N = 100; s = 0; % using sum as a name shadows the function sum() for k ...

5 days ago | 0

| accepted

How to align of words in matlab legend ?
So long as a variable-width font is in use, you're going to be fighting it. y = rand(3,10); plot(y); % all three strings ha...

5 days ago | 1

I have created an algorithm for a median RGB image filter, however, it doesn't seem to be working.
I don't know why you're using a weighting array that doesn't exist, but since you say this is a median filter, I'm going to assu...

7 days ago | 0

| accepted

How to divide a sequence into 8 groups?
I am going to assume that your "data" is a long character vector with no delimiters. v = char(randi([48 57],1,64)) % example ve...

7 days ago | 0

| accepted

Why am i getting two different MSE, while using formula and syntax immse?
The reason is that the two images are integer-class. The difference and square may result in data truncation. moving_img = imr...

7 days ago | 1

| accepted