Community Profile

photo

Simon Chan


Hospital Authority

Active since 2021

Statistics

  • Knowledgeable Level 3
  • First Answer

View badges

Content Feed

View by

Answered
How to use writematrix to create a single xlsx file with multiple sheets with name of the analysis file?
Use function <https://www.mathworks.com/help/matlab/ref/fileparts.html fileparts> to extract the name instead of the entire file...

ungefär 4 timmar ago | 1

Answered
find ID's of repeated values in array
You may use a for loop as follows: idx = zeros(1,length(t1)); for k = 1:length(t1) idx(k) = find(ismember(t2,t1(k))); en...

ungefär 8 timmar ago | 0

| accepted

Answered
cration of contents inside the cell array of uniform size
May try the following to add NaN to the new rows load('data.mat'); addrow = cellfun(@(x) 8-size(x,1),Data,'uni',0); result = ...

2 dagar ago | 0

Answered
Why is it not working?
Index jj is not defined inside the for-loop, i guess the code should be modified as the following for ii=1:26 for jj = 1:2...

10 dagar ago | 0

| accepted

Answered
Index in position 2 exceeds array bounds (must not exceed 1) ?
One of the input argument is variable 'c' and you use the same name again for the size of variable 'a' and hence gives you an er...

11 dagar ago | 1

| accepted

Answered
Area fill under a curve
Check the MATLAB documentation about area. w is a function handle and it is not supported. Try the following: x=linspace(0,2*...

12 dagar ago | 0

Answered
Separate 24 digits single array of data loaded from file into 6 different arrays
Try the following by converting the text using function num2cell. clear; clc; fid = fopen('data.txt'); d = textscan(fid,'%s')...

16 dagar ago | 0

| accepted

Answered
Edge detection in gradient images
Try Otsu's method rawdata=imread('capture 1.png'); I = rgb2gray(rawdata); level = graythresh(I); BW = imbinarize(I,level); ...

17 dagar ago | 1

Answered
what happened to my install ?how to solve this proplem?
If your installation runs on WIndows, please check whether you have adminstrator right or not. On the other hand, you may refer...

19 dagar ago | 0

Answered
Plot 3D surface from Excel .csv File
You may extract the data using function readmatrix. clear; clc; rawdata = readmatrix('data.csv'); x = reshape(rawdata(:,1),[]...

19 dagar ago | 1

| accepted

Answered
How to write new data to the existing excel file?
You may replace the entire loop by using 'Append' as follows: writetable(T,'Results.xlsx','UseExcel', true, 'WriteMode','Append...

20 dagar ago | 0

Answered
Plots with different colors
Put the index and hold on inside the loop figure(1) for i=1:length(Re) if Re(i) < 2*10^3 loglog(Re(i),f(i),'xb','Lin...

23 dagar ago | 0

| accepted

Answered
How can I set the colorbar for a specific series of value ?
Adjust the Limits and Ticks as follows: cb = colorbar cb.Limits = [300 2100]; cb.Ticks=300:300:2100;

23 dagar ago | 0

| accepted

Answered
Best fit line in log-log scale
Like this? p=polyfit(log(X),log(Y),1); y=polyval(p,log(X)); figure(1) loglog(Re,f,'x','LineWidth',1) hold on loglog(X,exp(...

24 dagar ago | 0

| accepted

Answered
How to sort a 3D matrix according to the value of each element?
If I understand correctly, you would like the larger value(s) in the last rows and the largest one on the bottom right hand cor...

24 dagar ago | 0

Answered
using matlab fileread function for some portion of text data
Use function textscan to read the first 50 lines and the header will be stored on a cell array. fid = fopen(fullfile(filepath,f...

25 dagar ago | 1

| accepted

Answered
Subplot arrangement: 6 by 2 plot
Try this: figure(1) subplot(6,2,1) plot(1:10,randi(10,1,10)) hold on subplot(6,2,3) plot(1:10,randi(10,1,10)) subplot(6,2...

25 dagar ago | 0

| accepted

Answered
How to label the centers of circles according to their position on axes?
Try this and still using function text: clear; clc; I = ones(400,600); sorted_centers_x = repmat(50:100:550,1,4); sorted_cen...

25 dagar ago | 1

| accepted

Answered
How to use imwrite from dicom to png
It may contains more than one image and hence you need to save it one by one: Following code for your reference: [I, cmap] = d...

26 dagar ago | 0

| accepted

Answered
Specific conditions for array elements
You may simply combine them together as follows: B = (A>10)*(9^2)+(A==10)*0+(A<10)*(20^0.5);

26 dagar ago | 1

Answered
Replacing Empty Cells by NaN
T.Var1=NaN(size(T.Var1,1),1); % Replace T.Var1 by NaN T.Var16=NaN(size(T.Var16,1),1); ...

26 dagar ago | 0

Answered
How do I concatenate the same table n-times vertically?
Try this: biggertable=repmat(T,1000,1);

26 dagar ago | 0

| accepted

Answered
I'm working on an example where I'm getting a logical error possibly. I want to replace every element of a matrix by the minimum of its neighborhood.
The value of N will be very large in the loop and gives an error. Try the following to replace each element of the matrix by by...

27 dagar ago | 0

| accepted

Answered
Unrecognized function or variable 'wavread'.
It requires Signal Processing Toolbox, type 'ver' in the Command WIndow to check whether you have the right Toolbox or not.

27 dagar ago | 0

Answered
stl file rendering is not working can you help me to solve it?
You may need <https://www.mathworks.com/help/matlab/ref/trisurf.html trisurf> or <https://www.mathworks.com/help/matlab/ref/trip...

28 dagar ago | 0

Answered
How to extract matrix from cell?
Try this: iwant=cat(4,myCell{32:59});

28 dagar ago | 0

| accepted

Answered
How to delete duplicates and replace values in an array?
Create a table and use function groupsummary Item=["White Onion";"Potato";"White Onion";"Fruit"]; T=table(Item,'VariableNames'...

28 dagar ago | 0

| accepted

Answered
How to request a specific user input?
May do this ina while loop prompt = 'Please enter 1 for EXP1 and 2 for EXP2:'; % ask EXP = input(prompt); while (EXP ~= 1 && ...

28 dagar ago | 0

Answered
How can I write a for loop to do algebra over multiple arrays?
Try this: A = arrayfun(@(x) x.*time./(c+d), a, 'UniformOutput', false) result = cell2mat(A')

28 dagar ago | 0

Answered
How does one use bookmark feature in Livescript?
Refer to the following, a cyan marker will appear: Check this : Bookmarks

28 dagar ago | 0

| accepted

Load more