Circle moving in a velocity field Matlab
Is there anyway to code a blob moving in from a smaller pipe to a larger pipe in matlab, when the velocity fields at a particular point is known. It doesn't have to be an animation. Just figures at different time step. So, the final figure would look something like this. Thanks
See also questions close to this topic

Textbounds  psychtoolbox code
I have a piece of code that is not working as intended and I can't figure out why, especially because it used to work on a different computer (and probably a different version of matlab but I don't have access to the computer to check).
I am trying to build an hierarchical letter (The letter X made from smaller A's). I created a texture the size of the screen, wrote a letter to the center of the texture, then tried to use the DrawFormattedText textbounds function to write more letters at specific locations relative to the central letter.
However, when I run the code the central letter doesn't appear to be in the center of the screen, the top half of the X is stretched out, and the lower half is squished. I am only including one example of the code here but the same thing seems to apply to other letter's I've built (so the letter H built from X is also stretched on top and squished on the bottom).
These are images of the code when it worked and when it didn't: https://imgur.com/a/THZHmsk
Any suggestions on how to get this code to work properly would be greatly appreciated. Thank you!
Here is a simplified version of the code:
clear all HideCursor; %% %0 for one monitor, 1 for two or more monitors WinNum = 0; %Determine Monitor Resolution ScreenRes = Screen('Resolution', WinNum); xCenter = (ScreenRes.width)/2; yCenter = (ScreenRes.height)/2; Background = [100,100,100]; % Higher numbers are lighter BackgroundIndex = 100; white = [255 255 255]; black = [0 0 0]; Grey_LowC = [139 139 139]; % 25 percent of the distance between white and the background grey, rounded up. red = [255 0 0];%For testing purposes and feedback. green = [0 255 0]; InstructionTxtSize = 18; StimTextSize = 50; w = Screen('OpenWindow',WinNum,Background); %% %Example 1 Parameters InstructionRect = ones(ceil(ScreenRes.width), ceil(ScreenRes.height)).* BackgroundIndex; InstructionTexture = Screen('MakeTexture', w, InstructionRect); Screen('TextSize', InstructionTexture, StimTextSize); Screen('TextFont', InstructionTexture, 'Anonymous Pro'); LetAdj = 10;%add spaces between letters TxtColor1 = red; TxtColor2 = white; LocLet = 'A'; %Global X [~,~, X_textbounds4] = DrawFormattedText(InstructionTexture, LocLet, 'center', 'center', TxtColor1,[],[],[],[.75] ); X_Diff = X_textbounds4(3) X_textbounds4(1) + LetAdj; Y_Diff = X_textbounds4(4) X_textbounds4(2) + LetAdj; %Top of X [~,~, X_textbounds3L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds4(1)(X_Diff*.75), X_textbounds4(2)Y_Diff, TxtColor2,[],[],[],[.75]); [~,~, X_textbounds2L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds3L(1)(X_Diff*.75), X_textbounds3L(2)Y_Diff, TxtColor1,[],[],[],[.75]); [~,~, X_textbounds1L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds2L(1)(X_Diff*.75), X_textbounds2L(2)Y_Diff, TxtColor2,[],[],[],[.75]); [~,~, X_textbounds3R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds4(1)+(X_Diff*.75), X_textbounds4(2)Y_Diff, TxtColor2,[],[],[],[.75] ); [~,~, X_textbounds2R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds3R(1)+(X_Diff*.75 ), X_textbounds3R (2)Y_Diff, TxtColor1,[],[],[],[.75] ); [~,~, X_textbounds1R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds2R(1)+(X_Diff*.75 ), X_textbounds2R (2)Y_Diff, TxtColor2,[],[],[],[.75] ); %Bottom of X [~,~, X_textbounds5L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds4(1)(X_Diff*.75), X_textbounds4(2)+Y_Diff, TxtColor2,[],[],[],[.75]); [~,~, X_textbounds6L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds5L(1)(X_Diff*.75), X_textbounds5L(2)+Y_Diff, TxtColor1,[],[],[],[.75]); [~,~, X_textbounds7L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds6L(1)(X_Diff*.75), X_textbounds6L(2)+Y_Diff, TxtColor2 ,[],[],[],[.75]); [~,~, X_textbounds5R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds4(1)+(X_Diff*.75), X_textbounds4(2)+Y_Diff, TxtColor2,[],[],[],[.75]); [~,~, X_textbounds6R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds5R(1)+(X_Diff*.75), X_textbounds5R (2)+Y_Diff, TxtColor1 ,[],[],[],[.75] ); [~,~, X_textbounds7R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds6R(1)+(X_Diff*.75), X_textbounds6R (2)+Y_Diff, TxtColor2 ,[],[],[],[.75] ); SourceRect = [X_textbounds1L(1)(LetAdj*7),X_textbounds1L(2)(LetAdj*7),X_textbounds7R(3)+(LetAdj*7), X_textbounds7R(4)+ (LetAdj*7)]; X_Dim = SourceRect(3)SourceRect(1); Y_Dim = SourceRect(4)SourceRect(2); DestinationRect = [xCenter(X_Dim/2),yCenter(Y_Dim/2),xCenter+(X_Dim/2),yCenter+(Y_Dim/2)]; Screen('DrawTexture', w, InstructionTexture, SourceRect, DestinationRect); Screen('Flip',w); KbWait([], 2); Screen('CloseAll');

Undefined variable "daq" or class "daq.ni.ThermocoupleType.setValue"
This is probably a silly question, but I haven't found a good answer anywhere on the internet yet.
I am trying to acquire temperature data from an NI TC01 thermocouple, but everytime I run the sample code  link: https://www.mathworks.com/matlabcentral/fileexchange/29707readanationalinstrumentsusbtc01singlechannelthermometerinmatlab
I get the error [Undefined variable "daq" or class "daq.ni.ThermocoupleType.setValue"].
I know that I have the data acquisition toolbox, but I can't figure out how to run this code. Does anyone have any ideas/solutions?
Thank you

How object recognition name converted into voice in Matlab?
Hi i am trying to convert name of object in voice .Name of object which come after object recognition.How this be possible enter image description here

Plotting many graphs with different and distinguishable colors
I have this plotting loop and I want to assign different colors to that. Now it considers only the colors that it wants. So, when
N
increases, the colors of some of the graphs are the same. So distinguishing between them is really hard. How can I dedicate different colors to the different graphs?N=24
and is the number of the graphs.for i=1:N plot(time(1:350),STDX(1:350,i),'lineWidth',3) hold on end

How can I complete the edge of circle in image
I make Drill Robot with image processing.That is GUI and the images befor and after processing
So I have 2 images , one from camera and the second after processing.
I put that images in 2 Axes
why the image appear in axes2 with not good edge that error effect to center of drill which i want to calcuate
that is my bottun code
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved  to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % imaqtool %set(handles.axes1,'visible','on') ; vid = videoinput('winvideo', 1, 'RGB24_800x600'); src = getselectedsource(vid); vid.FramesPerTrigger = 1; g=getsnapshot(vid); pause(2); [m n k]=size(g) f=rgb2gray(g); %imshow(f); [r,ch]=imhist(f); %figure;plot(ch,r); for i=4:length(ch)3 if(r(i)~=0) r1(i)=sum(r(i3:i+3))/5; end end %figure;plot(r1); for i=1:4:230 if((r1(i+4)r1(i))>1000) r1(i:255)=0; end end h=diff(r1); %figure;plot(h); u_0=max(h); u_1=min(h); I1=u_0(1); I2=u_1(1); i0=min(max(find(h==I1))); i1=min(max(find(h==I2))); if(i0<i1) bwImg=im2bw(rgb2gray(g),(i1)/255); else bwImg=im2bw(rgb2gray(g),(i0)/255); end bwImg=1bwImg; P3=imdilate(bwImg,strel('disk',15)); J=bwlabel(P3); Ml=max(max(J)) i=1; while i<Ml Zm(i)=length(find(J==i)); i=i+1; end i1=find(Zm<2300); i2=find(Zm<500); BWW=zeros(size(J)); for i=1:length(i2) J(find(J==i2(i)))=0; end for i=1:length(i1) BWW(find(J==i1(i)))=1; end BWW(1:40,:)=0; BWW(560:end,:)=0; BWW(:,1:40)=0; BWW(:,760:end)=0; P33=imdilate(BWW,strel('disk',3)); P34=P33BWW; imshow(g,'Parent', handles.axes1); imshow(P34,'Parent', handles.axes2); J=bwlabel(P34); Ml=max(max(J)) i=1; while i<=Ml [xa17 ya17]=find(J==i); cx(i)=floor((sum(xa17)/length(xa17))/10); cy(i)=floor((sum(ya17)/length(ya17))/10); i=i+1; end cx cy i=1; cxx(1)=(cx(1)/4)*40 for i=2:length(cx) if(cx(i)>cx(i1)) cxx(i)=(((cx(i)cx(i1))/4)*40)+cxx(i1); elseif(cx(i)==cx(i1)) cxx(i)=1+cxx(i1); elseif(cx(i)<cx(i1)) cxx(i)=cxx(i1)(((cx(i1)cx(i)))/4)*15; end end cxx=floor(cxx); sx = num2str(cxx, '%04d') i=1; cyy(1)=(cy(1)/4)*20 for i=2:length(cy) if(cy(i)<cy(i1)) cyy(i)=(((cy(i)cy(i1))/4)*20)+cyy(i1); end if(cy(i)==cy(i1)) cyy(i)=1+cyy(i1); end if(cy(i)>cy(i1)) cyy(i)=cyy(i1)(((cy(i1)cy(i)))/4)*20; end end cyy=floor(cyy); sy = num2str(cyy, '%04d')
 Space for messages in figure