Submitted


Random Integers With a Specified Sum and Range
Generate random integers with specified sum and parameters from various distributions.

4 years ago | 1 download |

0.0 / 5
Thumbnail

Answered
Asking about the rounding numbers. (Problem with rotating image)
I mentioned mapping from output back to input. Here is one crude example. This still uses no interpolation. inpict = imread('...

4 years ago | 0

| accepted

Answered
How to convert .hdr image data set to .mat?
You can use multibandread() to read these types of data files. https://www.mathworks.com/help/matlab/ref/multibandread.html ...

4 years ago | 1

| accepted

Answered
How can I create a function of my code
This probably covers what you are trying to do. I assume your problem description is as follows: You have a cell array of scal...

4 years ago | 0

| accepted

Answered
How can I crop a set of non-binary images automatically depending on the size and position of each image?
If the excess area is a solid color (you mentioned white), then I and ImageAnalyst mention multiple methods in this thread: htt...

4 years ago | 0

| accepted

Answered
How to open extension .a00 and .sin image Using Matlab
Like KSSV says, use fread() fid = fopen('YourProjection (1).sin','r'); A = fread(fid,Inf,'*uint16'); fclose(fid); A = resh...

4 years ago | 0

| accepted

Answered
Stretch downsampled data to fit on same x axis
There are probably tools to do this in SPT, but I don't see why interpolation won't work. Fs = 2000 t = 500 ar1 = 1:1:Fs*t; ...

4 years ago | 0

| accepted

Answered
nearest(100*rand()) does not work
Yeah. The error is because you don't have Fixed-point Toolbox. You can either use Matt's suggestion above, or depending on w...

4 years ago | 1

| accepted

Answered
Customize the background color in imagesc
If you're talking about the background of the image, that's determined by the image content and the colormap you're using. Sele...

4 years ago | 0

| accepted

Answered
I want to design a Homework Problem Solver
Here's part of a solution: instr = 'Given P = 100 kpa, V = 2 litres, T = 273 K, R = 8.314 Solve for n.'; P = str2double(rege...

4 years ago | 0

Answered
Elementary matrices in Matlab
(EDIT to fix misread) Here's one way: n = 8; z = zeros(1,n-3); R = toeplitz([0 2 -1 z],[0 -2 1 z])

4 years ago | 2

Answered
Using if statement for switch
This is a simplified conceptual example of one way. % define a list of valid strings validforcestr = lower(["N" "lb" "oz" "kN"...

4 years ago | 0

Answered
MATLAB can't read files and run the code. The error says that file doesn't exist
I'm going to take a blind shot and guess that your path doesn't actually have two nested directories of the form ...MatlabCode...

4 years ago | 0

Answered
I am getting an error 'Index in position 2 is invalid. Array indices must be positive integers or logical values.' please help ? Thanks in advance.
Using round() to generate array indices does not guarantee that the results are within [1 size(A,thisdim)]. In this case, the c...

4 years ago | 0

Answered
Can I recreate this using commands?
Here's one way using implicit array expansion. L = 4; D = 2; % using a loop o = 0; for i = 1:D for j = 1:D ...

4 years ago | 1

Answered
How to do these legends/colorbar?
If you're asking how to get that colormap applied to a line plot, then you can use the axes 'colororder' property. If you want ...

4 years ago | 0

Answered
Divid 3D space into grid of n x n x n
Something like this? This returns three 3D arrays which uniformly increment in steps of 3, from 1 to 10. [xx yy zz] = ndgrid(1...

4 years ago | 0

Question


Using regexprep to clean up MATLAB code formatting
I was trying to put together something to fix operator spacing in a bunch of old .m files. I'm reducing this problem example to...

4 years ago | 0 answers | 0

0

answers

Answered
Why can't I generate a sphere with a material?
Set up the lights. [X,Y,Z]= sphere(20); x2 = X.*50; y2 = Y.*50; z2 = Z.*50; h = surf(x2,y2,z2); light('Position',[1 3 2]);...

4 years ago | 0

| accepted

Answered
Error using insertText Expected input number 1, I, to be one of these types: uint8, uint16, int16, double, single
The first argument to insertText() is an image array. You aren't providing that. https://www.mathworks.com/help/vision/ref/ins...

4 years ago | 0

Answered
Why is my 3d plot blank if the vectors are not empty?
The reason why the plot looks like nothing (or just like a tiny speck) is because the plot is a straight line that just happens ...

4 years ago | 0

Answered
How to calculate an average of each 24 numbers in the same serie.
Assuming you want this to be done blockwise, here's one way: v = 1:20; bkavg = mean(reshape(v,5,[]),1) @Image Analyst has a p...

4 years ago | 0

| accepted

Answered
How do I do Edge detection with filling the holes?
edgefr = edge(graybg,'Sobel'); % this is your variable name BWBW = bwareaopen(imfill(edgefr,'holes'),20); % wrong variable name...

4 years ago | 0

Answered
Textscan issues while from file
I have no idea what this data is, but I'm going to guess that reading every other value into two vectors makes no sense. Since ...

4 years ago | 0

Answered
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 15-by-7-by-6.
k_nanopcm and T_nanopcm are the same size (15x7x6). In this assignment, the LHS is a scalar. The RHS is a function of a bunc...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 0

Answered
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) + ...

4 years ago | 0

Answered
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...

4 years ago | 0

| accepted

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

4 years ago | 1

| accepted

Answered
*.* 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...

4 years ago | 0

| accepted

Load more