Changing Fonts Data Cursor in Matlab Plots - matlab

I would like to change the properties of the Data Courses to let him bigger and bold. Besides how is the best way to export the figure with qualiade?
tks

http://www.mathworks.com/support/solutions/en/data/1-8FU2S5/:
alldatacursors = findall(gcf,'type','hggroup')
set(alldatacursors,'FontSize',20)
set(alldatacursors,'FontName','Times')

The above answer gave me an error:
Error using hg.hggroup/set
The name 'FontSize' is not an accessible property for an instance of class 'line'.
This worked better for me:
cursorMode = datacursormode(gcf);
dataTipsH = cursorMode.DataCursors;
set(dataTipsH,'FontSize',12)

Related

Is there way to customize col_max value without change python-click source code?

I'm facing a very concrete problem with python-click 8.1.3. The helptext created by Click wastes too much column space when an option name is a tad long. Depicted in picture below:
I trace into Click's source code, and pinpoint a hardcoded value in HelpFormatter.write_dl(), the col_max parameter determines first-column max-width, which is 30, and I hope to reduce it to 16.
As a Click-library user, how can I achieve this without modifying Click's source code? Maybe some class inheritance or patching trick?
Thank you in advance.
You can do something like this:
class MyHelpFormatter(click.HelpFormatter):
def write_dl(self, rows, col_max=5, col_spacing=2):
super().write_dl(rows, col_max, col_spacing)
click.Context.formatter_class = MyHelpFormatter
Check this answer for a similar example

How to fill tables in powerpoint from a cell array in matlab?

I've downloaded saveppt2, jrichter's code and even WritetoWordfromMatlab and tried reading through them to figure it out with no luck. I have something of my own built already so I just need to figure out how to get tables to work.
Whenever I try something like:
myTable.Cell(1,1).TextFrame.Text = 'textstring'
or
myTable.Table.Cell(1,1) = 'textstring'
Or any combination of table / text commands I end up with there being no such property or function as cell for table objects. Every COM/VBA/C library I can find, as well as some code in Python (PandastoPowerPoint from Github) that does what I'm aiming to do says that Table.Cell(row,col) should work. Is this specifically a problem with matlab trying to use (#,#) as a form of indexing?
Try
myTable.Cell(1, 1).Shape.TextFrame.TextRange.Text = "TextString"
or = 'TextString' if that's what matlab prefers.
Thanks Steve R! With a little tweak, I got it to work, finally. So here's the answer:
% add table to existing slide object
myTable = slide.Shapes.addTable(nRows,nCols,x0,y0,rowWidthnRows,colHeightnCols)
myTable.Table.Cell(1, 1).Shape.TextFrame.TextRange.Text = 'TextString'

GAMS: retrieve information from solution

GAMS: I think I have a pretty simple question, however I'm stuck and was wondering if someone could help here.
A simplified version of my model looks like this:
set(i,t) ;
parameter price
D;
variable p(i,t)
e(i,t);
equations
Equation1
obj.. C=sum((i,t), p(i,t)*price);
Model file /all/ ;
Solve file minimizing C using MIP ;
Display C.l;
p(i,t) and e(i,t) are related:
Equation1 .. e(i,t)=e=e(i,t-1)+p(i,t)*D
Now I want to retrieve information from the solution: lets say I want to know at what t e(i,t) has a certain value for example --> e(i,t)= x(i) or otherwise formulated e(i,t=TD)=x(i) find TD, where x(i) thus is depending on i. Does anyone know how I can write this in to my GAMs model? To be clear I do not want to change anything about my solution and the model I have runs; I just want to retrieve this information from the solution given.
So far I tried a couple of thing and nothing worked. I think that this must be simple, can anyone help? Thank you!
Try something like this:
set i /i1*i10/
t /t1*t10/;
variable e(i,t);
*some random dummy "solution"
e.l(i,t) = uniformInt(1,10);
set find5(i,t) 'find all combinations of i and t for which e.l=5';
find5(i,t)$(e.l(i,t)=5) = yes;
display e.l,find5;
Hope that helps,
Lutz

JES: Implementing modification code to a Loop

I am using JES and am wondering what built in function I should use to make this effect work.
newG=(oldG+(abs(x*y*2.57901)%64))%256
So far I have this code
def forLoop():
picture = makeEmptyPicture(300,200)
show(picture)
for p in getPixels(picture):
setColor(p,black)
repaint(picture)
for p in getPixels(picture):
oldG=(p)
newG=(oldG+(abs(x*y*2.57901)%64))%256
repaint(picture)
The error I get is
The error was:x Name not found globally.
A local or global name could not be found. You need to define the function or variable before you try to use it in any way.
you'll need to define the local names for x and y to be able to get the newG color, hope this helps
coding is something like this:
x= getX(p)
y= getY(p)

Matlab: Update an excel sheet

I am using Matlab to read a workbook with a bunch of sheets in it.
I do some calculation and have to update one particular column in one sheet. I tried using xlswrite after xlsread, it does not work.
So, my code looks something like:
[~,~,Data] = xlsread('MyFile.xlsx', 'MySheet');
Data(2:end-1,5) = Data(2:end-1,5) + 1.5; %Random operation for illustration only
ret = xlswrite('MyFile.xlsx',Data,'MySheet');
But ret is 0. So, I am not able to achieve replacement process. Can you please help.
Thanks
Based on my own comment:
Please use the second output argument as well an check what message you get:
[status,message] = xlswrite(filename,A,sheet)
Hopefully that is sufficient to find the cause, please let us know if that's the case.
Apparently it was indeed sufficient for the asker.