Community Profile

photo

Joseph Cheng


Last seen: Today
656 total contributions since 2014

Systems Engineer for Electro-Optical Systems

Contact

Joseph Cheng's Badges

  • MATLAB Central Treasure Hunt Finisher
  • First Review
  • 24 Month Streak
  • Thankful Level 1
  • Pro
  • Knowledgeable Level 4
  • First Answer
  • Solver

View details...

Contributions in
View by

Answered
Taking average of pixel values across multiple frames
couldn't you just put it into a non cell matrix of 5504 x8256 x 3 then use mean(data,3) to take the mean in the 3rd dimension? o...

16 hours ago | 1

Answered
Why am I getting an invalid file identifier error when using "parfor" but the same function works fine (albeit slow) with "for"?
From the looks of it you've opened a file then trying to use parfor to grab items out of the opened file. However thats where t...

16 hours ago | 0

Answered
How to get rid of blank space in a heatmap panel of 3 figures?
have you looked at the functions axis equal or axis square those might be applicable to you and not have to only use top h...

18 hours ago | 0

Answered
How read in comment style to skip the header of a text file?
you can quickly scan the file(s) for the number of header lines like file= 'Graphite_Node_test.txt'; fid = fopen('Graphite_Nod...

18 hours ago | 0

Answered
Contour is plotting my data in reflected order?
From a quick test you might not be asigning the x and y values when performing your contour() function. by doing so matlab will...

20 hours ago | 0

| accepted

Answered
Create a matrix with elements clockwise
While probably not the most efficient way you can fill in edges like i've done here: clc;clear all x = zeros(5,8); %generate m...

1 day ago | 1

Answered
Update a for loop with if statements
Without running your code i think you can create a sign variable of (-1)^(0 or 1) which switches between 0 or 1 depending on whe...

4 days ago | 0

| accepted

Answered
Represent array in percentage
you would take your array, subtract the minimum, then divide by the resulting maximum x 100 x = [2.4:.4:4.2]; x = x-min(x); ...

4 days ago | 1

| accepted

Answered
How to make the length/dimension of 6 different 3D vectors the same?
probably the easiest way is to fill a zero array created to be the same max size then populate the indexes with the values: var...

7 days ago | 1

| accepted

Answered
Extract pixel values inside a Binary Mask
since you already created a binary mask you can just index multiply " .* " the mask with the original image as outside is 0 and...

7 days ago | 0

Answered
how to color and label only certain histogram bars?
Here is an example for @Adam Danz said with using bar y = randn(100); [N X]=hist(y(:),10); %plot all the data figure,clf,hb...

9 days ago | 1

Answered
Looking for a matlab script that extracts data from a plot figure ( here 2D contours from Covariance matrix or Markov chains) and reproduce the original figure
your graph is a bit messy with text and lines that denote items. here is a quick example that may push you along. It'll need a...

9 days ago | 0

| accepted

Answered
Scientific notation at y-axis with yticks/yticklabels
from the looks of it the desired state is also plotting in a log10. you can change the current axis by set(gca,'yscale','log'...

10 days ago | 0

| accepted

Answered
Find the indices of the imaginary element of the matrix
you can do a comparison to the real(A) like A=[1 2 3; 4+i 5 6-i; 7 8+i 9] [row col]=find(A~=real(A)) ...

10 days ago | 0

Answered
How to make the code efficient?
You can do things all at once cine you're not dependent on previous values. n=4 x=[0:n-1]; y=[0:n-1]; k = 0; %%Orig_code ...

10 days ago | 0

Answered
Double sigma with exception case
in your nested forloop you can put a check in for if j==i then continue. you do have a check up there with i~=j which should w...

10 days ago | 0

| accepted

Answered
Remove shadow and unwanted background
to get your started you can see that the tissue and the shadow area have similar values in all the color channels. you can do a...

10 days ago | 0

Answered
How do I plot the upper view of a matrix and represent the intensity color?
Here is an example of what i'm thinking you're doing. Not sure what you're doing with the weighted average but i think i did so...

13 days ago | 1

| accepted

Answered
How to vertically and horizontally scan an image to store a coordinates (positions) of the elements having values other than 255.
do you need to "scan" in a for loop or are you just looking for the positions of the colors? if you don't need to scan in a for...

14 days ago | 0

Answered
How to plot an equation qith specific data range?
For this you can use the function ylim() clc clear x=0:5:100; y=3*x+10; y1=4*x+5; plot(x,y) hold on plot(x,y1) ylim([25...

15 days ago | 0

Answered
How to include function in legend
do you need to use latex as just using the default tex? as latex uses $ for markup of symbols i don't know if it'll take the sy...

15 days ago | 1

Answered
Having trouble with looping through fields in a struct
primarily its because of the data.t = zeros(length(list)); data.p = zeros(length(list)); where you've set the t and p to be ...

16 days ago | 0

Answered
how to add a label to a contourf plot next to colourbar?
you can set a ylabel by passing the colorbar handles into ylabel [X,Y] = meshgrid(1:12,1:24); Z = sin(X) + cos(Y); figure(1),...

16 days ago | 1

| accepted

Answered
Plotting streamlines from a dataset (x,y,u,v)
So, meshgrid generates a grid of x and grid of y values so index wise you get the xy pair-combo. usually very useful when you're...

16 days ago | 1

| accepted

Answered
Change variables in for loop
That is because you're evaluating a string in that inpoly and not the variable x_e#... ideally you wouldn't want to do the evalu...

16 days ago | 0

| accepted

Answered
hello everyone. How to make the direction of points drawn on Cartesian coordinate system consistent with that drawn on binary image.
in a displayed image (0,0) is top left corner but cartesian is bottem left if in the ++ quadrant. so remedy this you can set th...

16 days ago | 0

| accepted

Answered
Help sketching equation into 3d graph
what you'll need to do is use the function meshgrid() which will then create a 2D matrix for both x and y such that you can get ...

17 days ago | 1

Answered
Bars disappear with log scale
While not ideal this should get you by since bar tries to plot the bar all the way to 0 which log scales don't show y=randi(100...

17 days ago | 0

Answered
pre-define a struct/array of structs in attempt to get rid of out of memory error.
the pre-allocation can be done (though can't really find the right way ultimateR = []; temp = struct('name',[],'size',[],'resu...

17 days ago | 0

Solved


Implement simple rotation cypher
If given a letter from the set: [abc...xyz] and a shift, implement a shift cypher. Example: 'abc' with a shi...

9 months ago

Load more