Answered

I want to convert from Cartesian to spherical coordinates in MATLAB. I have tried to use cart2sph in MATLAB but it is showing some error

You have to actually input the x, y and z vectors separately.Like [azimuth,elevation,r] = cart2sph(V(:,1),V(:,2),V(:,3));

I want to convert from Cartesian to spherical coordinates in MATLAB. I have tried to use cart2sph in MATLAB but it is showing some error

You have to actually input the x, y and z vectors separately.Like [azimuth,elevation,r] = cart2sph(V(:,1),V(:,2),V(:,3));

3 years ago | 0

| accepted

Answered

How to reshape a 3D array to 2D array along the diagonals?

Checkout: <https://www.mathworks.com/help/matlab/ref/blkdiag.html blkdiag>

How to reshape a 3D array to 2D array along the diagonals?

Checkout: <https://www.mathworks.com/help/matlab/ref/blkdiag.html blkdiag>

3 years ago | 1

| accepted

Answered

is there any way to set up a script to run a general amount of nested loops?

Why not just do val(1,:,:) or val(i,:,:)?

is there any way to set up a script to run a general amount of nested loops?

Why not just do val(1,:,:) or val(i,:,:)?

3 years ago | 0

Answered

Index a row of a matrix using as indexes specific ordered elements

This should work for most cases, it will also catch cases that wrap around though like a row [4 3 5]: [row column] = find((...

Index a row of a matrix using as indexes specific ordered elements

This should work for most cases, it will also catch cases that wrap around though like a row [4 3 5]: [row column] = find((...

3 years ago | 1

| accepted

Answered

how to create my own library in Matlab?

MATLAB does have in some sense an overlooked and under-utilized analogue to libraries called <https://www.mathworks.com/help/mat...

how to create my own library in Matlab?

MATLAB does have in some sense an overlooked and under-utilized analogue to libraries called <https://www.mathworks.com/help/mat...

3 years ago | 0

Answered

3D Surface Plot Showing Flat Surface

You for got a dot somewhere: x=[0:1:15]; y=[0:1:15]; [xx,yy]=meshgrid(x,y); zz=xx+(2*xx.*yy.^2)+3*xx; % HERE surf(x...

3D Surface Plot Showing Flat Surface

You for got a dot somewhere: x=[0:1:15]; y=[0:1:15]; [xx,yy]=meshgrid(x,y); zz=xx+(2*xx.*yy.^2)+3*xx; % HERE surf(x...

3 years ago | 0

| accepted

Answered

Error in function at if-elseif

x is a vector at this point so your comparisons are not resolving to a single true false. I am guessing this is what you meant t...

Error in function at if-elseif

x is a vector at this point so your comparisons are not resolving to a single true false. I am guessing this is what you meant t...

3 years ago | 1

| accepted

Answered

How do I get a script to wait until a figure is closed?

_uiwait_ will probably halt the execution completely. I think you want the program to keep running until the figure is closed in...

How do I get a script to wait until a figure is closed?

_uiwait_ will probably halt the execution completely. I think you want the program to keep running until the figure is closed in...

3 years ago | 0

Answered

Multiplication of Array of Matrices with Array of scalars

I believe you are over-complicating your problem by thinking as if you are working things out on a board. Your operation is sepa...

Multiplication of Array of Matrices with Array of scalars

I believe you are over-complicating your problem by thinking as if you are working things out on a board. Your operation is sepa...

3 years ago | 0

Answered

How to add new rows in an existing .mat file?

Take a loot at this: <https://www.mathworks.com/help/matlab/ref/matfile.html MATFILE>. This is actually a function, and you c...

How to add new rows in an existing .mat file?

Take a loot at this: <https://www.mathworks.com/help/matlab/ref/matfile.html MATFILE>. This is actually a function, and you c...

3 years ago | 1

Answered

How can i get the coordinates of a location from (e.g.) Google Maps into matlab?

To do this in an automated where you click on a map point and a coordinate appears in MATLAB in real time would require a massiv...

How can i get the coordinates of a location from (e.g.) Google Maps into matlab?

To do this in an automated where you click on a map point and a coordinate appears in MATLAB in real time would require a massiv...

3 years ago | 0

| accepted

Answered

How can I input values through variables in a multi-variable equation

This should help: <https://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html Anonymous Functions>

How can I input values through variables in a multi-variable equation

This should help: <https://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html Anonymous Functions>

3 years ago | 0

Answered

how to save a name in a cell

If you intended to use cells, they are indexed with curly brackets: category{k} = v;

how to save a name in a cell

If you intended to use cells, they are indexed with curly brackets: category{k} = v;

3 years ago | 0

| accepted

Answered

How can I visualize a 3D matrix with boolean values (0 or 1)?

<https://www.mathworks.com/help/matlab/ref/isosurface.html Isosurface> is one way. <https://www.mathworks.com/matlabcentral/...

How can I visualize a 3D matrix with boolean values (0 or 1)?

<https://www.mathworks.com/help/matlab/ref/isosurface.html Isosurface> is one way. <https://www.mathworks.com/matlabcentral/...

3 years ago | 0

| accepted

Answered

remove connected small objects in image

Look at <https://www.mathworks.com/help/images/ref/imopen.html imopen>. This might be an easy way to treat this particular case....

remove connected small objects in image

Look at <https://www.mathworks.com/help/images/ref/imopen.html imopen>. This might be an easy way to treat this particular case....

3 years ago | 0

| accepted

Answered

Subscript indices must either be real positive integers or logicals?

There is a more fundamental issue here: inv(A + u*u')=invA - 1/Z * invA * u*u' * invA The above line indicates that you ...

Subscript indices must either be real positive integers or logicals?

There is a more fundamental issue here: inv(A + u*u')=invA - 1/Z * invA * u*u' * invA The above line indicates that you ...

3 years ago | 1

| accepted

Answered

How to delete values using logical operator.

function f=test7() clc; r=[2 4 3 1 8 7 6 1 6 0]; r(r==4|r==6)=[]; f=r; end

How to delete values using logical operator.

function f=test7() clc; r=[2 4 3 1 8 7 6 1 6 0]; r(r==4|r==6)=[]; f=r; end

3 years ago | 0

| accepted

Answered

HELP!! I need to use a loop to make my cell array

Huh, my answer to this question seems to have disappeared. cat(2,master_location{:}) This should solve your specific pro...

HELP!! I need to use a loop to make my cell array

Huh, my answer to this question seems to have disappeared. cat(2,master_location{:}) This should solve your specific pro...

3 years ago | 0

Answered

Creating vectors from 0 to 1, i.e. 0:0.01:1 leads to invisible rounding errors?

Check "eps". Those are numerical artifacts introduced because you are accessing decimal points beyond the accuracy of MATLAB(dou...

Creating vectors from 0 to 1, i.e. 0:0.01:1 leads to invisible rounding errors?

Check "eps". Those are numerical artifacts introduced because you are accessing decimal points beyond the accuracy of MATLAB(dou...

3 years ago | 0

| accepted

Answered

How to use k means segmentation to segment color image without converting it into gray scale?

Read <https://www.mathworks.com/help/stats/kmeans.html#inputarg_X K-Means>, especially the part about "X" (the input). An image ...

How to use k means segmentation to segment color image without converting it into gray scale?

Read <https://www.mathworks.com/help/stats/kmeans.html#inputarg_X K-Means>, especially the part about "X" (the input). An image ...

3 years ago | 1

Answered

I want to get rid of unwanted blobs in the segmented image (i only need fruits in the image). Please suggest me a solution and attaching the image

Grab the red channel of that image and manually crop a portion of the red fruit as a small template (use "crop") run: normx...

I want to get rid of unwanted blobs in the segmented image (i only need fruits in the image). Please suggest me a solution and attaching the image

Grab the red channel of that image and manually crop a portion of the red fruit as a small template (use "crop") run: normx...

3 years ago | 0

Answered

Iterate through a dir structure to pull out only certain files into another dir structure.

Just use: list = dir('*.nrrd')

Iterate through a dir structure to pull out only certain files into another dir structure.

Just use: list = dir('*.nrrd')

3 years ago | 0

Answered

3D Interpolation around solid regions in volume data

If you have geometric knowledge of the invalid regions, one workaround is to eliminate them from the interpolation process. Use ...

3D Interpolation around solid regions in volume data

If you have geometric knowledge of the invalid regions, one workaround is to eliminate them from the interpolation process. Use ...

3 years ago | 0

Answered

crop a binary mask without other regions

If your images always contain 2 clearly separated entities, use `bwconncomp` or `bwlabel`. Many ways to do this. For example:...

crop a binary mask without other regions

If your images always contain 2 clearly separated entities, use `bwconncomp` or `bwlabel`. Many ways to do this. For example:...

4 years ago | 1

| accepted

Answered

Speed up Matrix Subtraction for Euclidean Distance calculation

If you have the stats & ML toolbox: NS = createns(M1'); % Create Search Object for The Train Set Idx = knnsearch(NS,M2')...

Speed up Matrix Subtraction for Euclidean Distance calculation

If you have the stats & ML toolbox: NS = createns(M1'); % Create Search Object for The Train Set Idx = knnsearch(NS,M2')...

4 years ago | 1

| accepted

Answered

What does this refer ?

All of these use cases have examples in documentation: Check out the first tip here: <https://www.mathworks.com/help/matlab...

What does this refer ?

All of these use cases have examples in documentation: Check out the first tip here: <https://www.mathworks.com/help/matlab...

4 years ago | 0

Answered

How to convert a stack of medical images in the work space into .png without losing information?

for i = 1:104 currentImage = YourData(:,:,i); currentFileName = ['YourFileName', num2str(i), '.png']; imwrit...

How to convert a stack of medical images in the work space into .png without losing information?

for i = 1:104 currentImage = YourData(:,:,i); currentFileName = ['YourFileName', num2str(i), '.png']; imwrit...

4 years ago | 0

Answered

How save data from cell to array?

Checkout <https://www.mathworks.com/help/matlab/ref/cell2mat.html cell2mat>.

How save data from cell to array?

Checkout <https://www.mathworks.com/help/matlab/ref/cell2mat.html cell2mat>.

4 years ago | 0

Answered

What does NaN mean here?

Looks like the code intended to initialize a matrix filled with NaNs and does this by adding NaN to a zero matrix. Any number + ...

What does NaN mean here?

Looks like the code intended to initialize a matrix filled with NaNs and does this by adding NaN to a zero matrix. Any number + ...

4 years ago | 1

| accepted

Answered

HI All ,Here i want to Reshape 2D images into 1D image vectors , why i get this error ? Error using '?? Transpose on ND array is not defined. Error in testauto (line 14) temp = reshape(img',r*c,1); .please help its urgent Thanks.

Not enough information, but it is likely that the image you are reading is a color image and is actually r by c by 3. I will als...

HI All ,Here i want to Reshape 2D images into 1D image vectors , why i get this error ? Error using '?? Transpose on ND array is not defined. Error in testauto (line 14) temp = reshape(img',r*c,1); .please help its urgent Thanks.

Not enough information, but it is likely that the image you are reading is a color image and is actually r by c by 3. I will als...

4 years ago | 0

| accepted