Community Profile

photo

Simon Chan


Hospital Authority

Active since 2021

Statistics

  • Pro
  • 6 Month Streak
  • Knowledgeable Level 4
  • First Answer

View badges

Content Feed

View by

Answered
Smoothed 2D histogram contour
Try this: data = readmatrix('xy.xlsx'); nbins=[200 200]; % You may adjust number of bin...

3 days ago | 0

Answered
Release a Message in GUI to user when calculation can't be performed
A sample example as follows, you may modify it to suit your purpose: A = [1 2 3 4; 2 3 4 5]; B = [3 4 5; 4 5 7]; fig = uifigu...

3 days ago | 0

| accepted

Answered
Calculating percentage of brown pixels over other colors in tumor
Define the tumor roi and then calculate the white pixels inside the roi: clear;clc; rawdata=imread('image.png'); BW = rgb2gra...

4 days ago | 0

| accepted

Answered
How can I make right axis off in Matlab plot?
Use function yyaxis and hide the right y-axis as follows: clear; clc; h = figure(1); hax = axes; y=randi(100,1,10); grid on...

4 days ago | 0

Answered
how can i correct this code and get rid of error? urgent help please
You need to specify the number of digits after the decimal point. For example, %.2f or %.4f for 2 and 4 digits after the deci...

4 days ago | 0

Answered
Assigning NaN to variables, inserting into a cellarray and then plotting Error
Suppose variable A is the data in your uitable. You may use function str2double B = str2double(A); Then plot it using B(:,...

5 days ago | 0

| accepted

Answered
MATLAB function gives me error
Check the length of variable 'u'. Looks like there is only 1 element inside variable 'u', but the function request to find the ...

6 days ago | 0

| accepted

Answered
binary matrix to decimal number
Try this: A = logical([1 0 1 1 0 0 1 0]); B = bin2dec(num2str(A))

6 days ago | 1

Answered
How to sum values in a matrix which are in the specified distance from one value?
You may try the following where the mask indicates the pixel where its distance is 50 pixels from your preset center pixel. ...

6 days ago | 0

Answered
Dot indexing is not supported error
If there exist a variable name mat_files.name, you are not allowed to use another variable with name mat_files. You may need ...

6 days ago | 0

Answered
How to add a column to a UItable in AppDesigner
I think it is better to record the number of columns in the uitable before you added a new column and assign the name to the new...

7 days ago | 0

Answered
Y data on the bar plot
Why not using the example in the documentation by getting the EndPoints as follows: clear; clc; x = [25 50 75]; vals = [6000...

8 days ago | 1

Answered
Why won't this function plot?
No need to use the for loop, Just use the following: plot(c1_exp)

8 days ago | 0

Answered
how to fit ylabel for the plots?
You may also experiment with the InnerPosition of 'gca'. Following shows an example: Nz = 100; A = randi(100,1,Nz); figure(...

8 days ago | 0

Answered
plotting Y data on scatter plot
Another option as follows: for i = 1:6 text(X(i),Y(i),sprintf('(%.0f)',Y(i))) end

9 days ago | 0

| accepted

Answered
how to convert dicom RT structure to binary mask
It uses world coordinates in x,y & z axis which is shown in your attached png file. So you need to capture the axis information ...

10 days ago | 0

Answered
How to plot unequal time series with same x-axis
You may try the following: T = readtable('data.csv'); % Read csv file as entire table TT2 = table2timetable(T(:,4:5))...

10 days ago | 0

| accepted

Answered
How to iterate matrix multiple times?
Write your code as a function and save it as a m-file (or use the attached file): function Lj = processLa(La) H = [1 1 1 ...

11 days ago | 1

Answered
Can anyone help me?
Varaible a becomes a character array after you use function num2str, so it is comparing a 'character' instead of a number. On t...

11 days ago | 1

Answered
How to I find the intersection point between y=x*exp(x)/(exp(x)-1) and y=3? I can't seem to have the intersection point displayed.
Use function fzero to help you to find the intersection. x = 1:1:10; f = @(x) x.*exp(x); g = @(x) exp(x)-1; y_1 = @(x) f(x)....

11 days ago | 0

Answered
How to check in one loop for multiple values V1,V2,V3... I have write the code but I am not getting value multiplied in answer
One possible way is to use a cell array instead of different variables as following: Use only one variable V. V(1) = {char(937...

12 days ago | 0

| accepted

Answered
Creating an Image from a Textfile Data using Matlab
Try the followings: (with editing below) Normalization just divide by 255 for uint8 image. [Ny,Nx,Nc] = size(input_image_3D); ...

12 days ago | 0

| accepted

Answered
Superimposing Graphs with large difference in Y-axis values
Try function <https://www.mathworks.com/help/matlab/ref/yyaxis.html yyaxis>

12 days ago | 1

Answered
How to create a custom grayscale colormap between white and black?
You may use 'colormapeditor' as follows to create a custom colormap:

14 days ago | 0

| accepted

Answered
plot in logarithmic scale
I think you may need to use function contour3. Then you can set the Z-axis scale to log by set(gca,'ZScale','log')

14 days ago | 0

Answered
changing dicom-dict.txt has no effect
You may refer to the following and try to create a new DICOM tag and write it to a new DICOM image. After that, the DICOM heade...

15 days ago | 0

Answered
What would be the MatLab code to get the output from the input image?.
Try the following: rawdata = num2cell((randi(10,10,4))); index = [2 2 2 1 2 3 4 2 1 2]'; singlecell = cellfun(@(x,y) x(y), nu...

16 days ago | 0

Answered
How can I save the result obtained from the For loop in one variable ?
You may assign another variable with index which stores the result within the loop for i = 1:10 %.... %.... [centers, r...

16 days ago | 1

| accepted

Answered
How to convert cell to matrix
Try this, where A is your 100001x2 cell: cell2mat(cellfun(@(x) x,A))

16 days ago | 0

Answered
How can I skip data while reading values from text file?
I try to use function fgetl as follows: Noticed that the first 2 rows have data format different from others, so they are remov...

16 days ago | 0

| accepted

Load more