I'm writing a Gui with Guide. I have an Edit text box in it. Is it possible to write a vector instead of a single value in this box?
Related
I want to use GUI (or directly the Command Windows) in MATLAB, which displays text. The text contain a few highlighted parts (which are changed during runtime), like this:
Is there any way I can do something liek that with MATLAB?
For command window you could try cprintf.
For displaying in a GUI you can use html formatting - going down this route you may find str2html useful.
I have a text file (.txt) that I want insert all containing of it to Matlab GUI and show it in a text box. Sometimes this text box updates when I GUI open it so there isn’t a specified text in it. (It is like a help note for my GUI that has text, numbers etc.) . I want insert whole containing of this text file automatically to my text box in Matlab GUI. What should I do?
Thanks.
Assuming the name of the text file as file1.txt and edit1 as the handles to the text-box, which is editbox in the context of MATLAB GUIDE, try inserting the following code inside the OpeningFcn callback or with some GUI component callback -
data1 = importdata('file1.txt','') %// Import all text as a cell array with each cell for each line
set(handles.edit1, 'Max', 2); %// Enable multi-line string input to the editbox
set(handles.edit1,'String',data1) %// Put the text from text file into the editbox using `String` property
set(handles.edit1,'HorizontalAlignment','left') %// Align the text left-based, as it looks good maybe, but feel free to change it to center or right
If the text file is not present in the current directory, provide absolute path to it instead of 'file1.txt'.
I am trying to create a program in MATLAB by which I can click on an image (using the input command) and MATLAB outputs a graphic marker on the image, and stores the data to a text file.
The motivation for this comes the Major League Baseball Gameday App, as I want to use it for a similar purpose, but on the input rather than the receiving end. I have created a code which takes an image and outputs a graphic marker at the points clicked. However, I need to improve the code by (hopefully) color coding each marker according to a manual input (maybe using the reply function?) and also numbering each marker. Also, I would like it to output the reply, location, and number to a text file which can be saved for later.
The code I have is below (with comments explaining what is missing), any help is appreciated.
img=imread('Path/Filename.png');
image(img);
title('Pitching')
ginput
%ask for reply of text between each click
M=[ans];
N=length(M);
hold on
for i=1:N
plot(M(i,1),M(i,2),'o','MarkerFaceColor','r','MarkerSize',25);
%make FaceColor coded according to reply from click
%number each click
%write data to text file
end
I want to write Greek characters and equations in textbox (Static Text) of Matlab GUI. Is it possible to write? I tried Latex $\eta { x }^{ 2 }+c$ but nothing changes. It displays the same.
Unfortunately it seems Matlab doesn't use the same text drawing methods on graphs, which support LaTeX, as it does on GUI elements. Here is a webpage explaining a workaround: http://undocumentedmatlab.com/blog/customizing-matlab-labels/
Basically, you will need to manually determine where you want the text to be on your GUI in terms of pixel position, and length, and rewrite your equation in HTML instead of LaTeX.
In the GUIDE interface for your GUI, you will need to click the "Editor" button on the toolbar menu, and find the section:
function initialize_gui(fig_handle, handles, isreset)
You'll want to insert your labeling code before the:
% Update handles structure
guidata(handles.figure1, handles);
I've got an exported version of a MATLAB diagram, similar to the one below. The problem is, that there are no axis captions. It's not possible to export the file again from MATLAB. I need to edit the PDF programmatically and edit about 100 diagrams, all with the same axis positions.
Is there a clean and fast way to paste the Strings X and Y at the corresponding positions in the pdf based on a batch process?
Create a PDF file with the captions. Add that as a background with to the PDF files with pdftk.
if know how to use LaTeX, the pstool package can bring you far on this on, including replacing labels (or actually any text on an eps figure) with TeX symbolic expressions. Neat if you're already working in LaTeX.