jan 0.23%
feb 2.56%
mar 0.76%
apr 4.19% <-- This is the highest value
may -0.36%
jun -1.68% <-- This is the lowest value
jul 1.18%
aug -0.99%
sep -1.43%
nov 2.32%
dec 1.88%
What code can generate exactly the figure above without apostrophe and without being too complicated. Using for loops maybe? Note that the color of all letters and numbers is black.
I tried the following code :
C={'jan' 0.23 ' ';'feb' 2.56 ' ';'mar' 0.72 ' ';'apr' 4.19 '<-- This is the highest value';'may' -0.36 ' ';'jun' -1.68 '<-- This is the lowest value';'jul' 1.18 ' ';'aug' -0.99 ' ';'sep' -1.43 ' ';'oct' 2.00 ' ';'nov' 2.32 ' ';'dec' 1.88 ' '}
And i got this
'jan' [ 0.2300] ' '
'feb' [ 2.5600] ' '
'mar' [ 0.7200] ' '
'apr' [ 4.1900] '<-- This is the highes…'
'may' [-0.3600] ' '
'jun' [-1.6800] '<-- This is the lowest…'
'jul' [ 1.1800] ' '
'aug' [-0.9900] ' '
'sep' [-1.4300] ' '
'oct' [ 2] ' '
'nov' [ 2.3200] ' '
'dec' [ 1.8800] ' '
But it's not even close to what i want, it is very incomplete, contains apostrophes and so.
Firstly, you have to find max and min value in second columns.
Then try using ``printf()'' to print out the columns, at the max and min index print the text.
Sorry, i'm using mobile so I can't write the answer in detail.
Column Value:
1.Column01 : '12'
2.Column02 : '34'
My SQL as follows :
Select CAST(Column01 as NCHAR(5)) || CAST(Column02 as NCHAR(3)) as NewColumn From Table
But, NewColumn value is:'1234'
I want final result should: '12 34 '
Who can tell me what? thanks!!
This will pad the first column to 5 characters before concatenating it with the second column:
Select RPAD(Column01, 5, ' ') || Column02 as NewColumn From Table
how can I extract the title from a cell array?
example :
for ii=1: nc
figure( h(ii) )
subplot( r,c,n(j) )
bar(B,FF) %<== istogramma
title('Istogramma Elemento',txt(1,2)); <==Istogramma Elemento : As
end
I should write a routine in which they are created 4 figures.
within each figure are put 4 histograms. For each histogram changes the title.
the normal size of the matrix is of type 31x15
1 2 3 4
'N° sul terreno' 'As ppm' 'Be ppm' 'Cd ppm'
'C26' '' '' ''
'C23' '' '' ''
'C19' '' '' ''
'C11' '' '' ''
'C27' '' '' ''
'C24' '' '' ''
'C21' '' '' ''
I am using textscan to read text file and I get <55x1 cell>
examples:
'aa a aa'
'a aaaa a'
'a = aaaaa'
'aaaaaa'
' a a a aaa'
'aa'
'aaa'
'aaaa'
.
.
.
.
I want to delete the white spaces in each sting
If I have a sting
string = 'I am 24 Years old'
And I use
string(ismember(string,' ')) = [];
it will eliminate the spaces and I will get
'Iam24Yearsold'
But with the cell doesn't work or I don't know how to do it
How can I do that? any suggestions please?
You can use strrep:
a = { 'aa a aa'
'a aaaa a'
'a = aaaaa'
'aaaaaa'
' a a a aaa'
'aa'
'aaa'
'aaaa'
'I am 24 Years old'};
strrep(a, ' ', '')
This results in
ans =
'aaaaa'
'aaaaaa'
'a=aaaaa'
'aaaaaa'
'aaaaaa'
'aa'
'aaa'
'aaaa'
'Iam24Yearsold'
My $condition in find() cannot make use of virtualfield.
I have this virtualfield on my Employee model:
var $virtualFields = array(
'AgentFullName' => "CONCAT(Employee.id, ' ', Employee.emp_ape_pat, ' ', Employee.emp_ape_mat, ' ', Employee.name)"
);
I'm using this condition to look on two fields, one regular, one virtual (
$idconditions = array(
'OR' => array(
'Employee.id LIKE' => $this->passedArgs['valsearch'],
'Employee.AgentFullName LIKE' => $this->passedArgs['valsearch']
));
My find returns no record when looking for a valid text that can be found on the virtual field:
$theid = $this->Horario->Employee->find('first', array(
'fields' => array('Employee.emp_appserial', 'Employee.AgentFullName'),
'conditions' => $idconditions,
));
However, the sql_dump seems correct:
When find() looks for an id number:
SELECT `Employee`.`emp_appserial`, (CONCAT(`Employee`.`id`, ' ', `Employee`.`emp_ape_pat`, ' ', `Employee`.`emp_ape_mat`, ' ', `Employee`.`name`)) AS `Employee__AgentFullName` FROM `devopm0_5`.`employees` AS `Employee` WHERE ((`Employee`.`id` LIKE 1005) OR ((CONCAT(`Employee`.`id`, ' ', `Employee`.`emp_ape_pat`, ' ', `Employee`.`emp_ape_mat`, ' ', `Employee`.`name`)) LIKE '1005')) LIMIT 1
And the find() using last name (returns no record)
SELECT `Employee`.`emp_appserial`, (CONCAT(`Employee`.`id`, ' ', `Employee`.`emp_ape_pat`, ' ', `Employee`.`emp_ape_mat`, ' ', `Employee`.`name`)) AS `Employee__AgentFullName` FROM `devopm0_5`.`employees` AS `Employee` WHERE ((`Employee`.`id` LIKE 'SMITH') OR ((CONCAT(`Employee`.`id`, ' ', `Employee`.`emp_ape_pat`, ' ', `Employee`.`emp_ape_mat`, ' ', `Employee`.`name`)) LIKE 'SMITH')) LIMIT 1
I wonder why the virtualfield cannot be subject to search.
Can you help?
Thank a lot !
You cannot use VirtualFields as SQL Conditions.
The virtual fields are added to the results after the find is performed, and this is why you cannot condition on them.
The Cookbook says:
These fields cannot be saved, but will be treated like other model fields for read operations. They will be indexed under the model’s key alongside other model fields.