Append only certain input values? - append

I'm trying to convert coordinates from MGRS to UTM. Most of the input MGRS coordinates are of 7 values. However, some are of 6 values. What method do I use to append extra values onto the coordinates with only 6 values?

Related

How do I turn 3x4x81x97 matrix into (long) column vector in Matlab [duplicate]

This question already has answers here:
How do you concatenate the rows of a matrix into a vector?
(2 answers)
Closed 6 years ago.
I have a data matrix (XW_region) that is size 3x4x81x97. Put differently, XW_region is indexed as (day,time,lat,lon), so there are 4 lat/lon grids (i.e. maps, populated by XW_region values) per day for 3 days, leading to 12 lat/lon grids total.
e.g. size(XW_region) = 3 4 81 97
What I want to do is take each XW_region value from each grid cell from each time from each day, and put them into one (long) column vector. From there I want to create a boxplot of the data. I know how to do the boxplot, just need to get the data all combined into one column vector.
Do I need to use the squeeze function to break out each map by day and time?
Thanks!
I'm sure this is a duplicate somewhere, but this is probably what you want:
XW_region(:)
see more about the column operator here.
As well as #bla's perfectly correct answer, sometimes it's useful to use reshape instead:
reshape(XW_region, [], 1);
(This pattern is helpful in cases where the thing you want to turn into a column is already an expression involving indexing).

setting YTickLabel matlab

what is wrong that i can not figure out in my YTickLabel:
h2=bar(myData);
ylabels=['1';'1.5';'2';'2.5';'3'];
set(gca,'XTickLabel',applicationNames),'XTick',applicationNames),'YTickLabel',ylabel));
p.s: I have tried this as well with no success:
ax=gca
ax.YTickLabel=['1';'1.5';'2';'2.5';'3'];
I am getting this error:
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
You are trying to create a character array. In this case, you are trying to create a 2D matrix where the number of columns should have the same number of characters and the number of rows denotes how many labels you have. For your strings, the maximum number of characters per column is three (number / dot / number). Because you have characters that are only of length 1 (i.e. just a number), you are getting an inconsistent concatenation error because it's expecting all characters to be of length 3 in the array.
What you actually need to use is a cell array to accommodate for the inconstant size of each y tick label. Therefore:
ax.YTickLabel={'1';'1.5';'2';'2.5';'3'};
Alternatively, because your labels are numbers, you can simply use a numeric array instead:
ax.YTickLabel = [1;1.5;2;2.5;3];
A cell array of characters is used if you want to label the x and/or y axis to be something other than just numbers. It's possible to label the y axis using text, such as:
ax.YTickLabel = {'John'; 'Paul'; 'George'; 'Ringo'; 'The Beatles'};

check how many times a column of an array is equal to a vector in matlab

I have an image converted with the use of im2cal in an array of 9 rows and 3867208 columns and i want to count how many times a vector containing a mask is equal to each column of the image without using for loops in matlab.Do you have any ideas?

find values inside a matrix matlab

I have a vector (or a matrix) which I want to print out certain values of it.
I will explain:
Let say I have a complex array.
I want to find all the values inside the array that are between 2 to 5.
How do I do that? I dont want to find the indices of these values! I want to print out (create a new array) my desire values.
Let's denote A your input matrix.
You say A is complex, so there are two cases:
A(real(A)>=2 & real(A)<=5) %% real values between 2 and 5
A(abs(A)>=2 & abs(A)<=5) %% modulus between 2 and 5

Core Plot skipped values Graph

i'm trying to draw a Graph with a user-friendly timeline having every day/week (to be decided by time range) as a label at x-axis. However, the datasource values are given on another basis - there might be 10 entries one day and the eleventh comes in a month.
See the photoshop image:
With the latest Core Plot drop I cannot find a way to do it, need your help.
Regards,
user792677.
The scatter plot asks the datasource for x-y pairs of data. There is no requirement that either value follow some sort of sequence or regular pattern. Other plot types work similarly, although the names and number of data fields can vary.
In your example, return 4 from the -numberOfRecordsForPlot: method. Return the following values from the -numberForPlot:field:recordIndex: method. The table assumes your y-values are calculated by a function f(x), but they can of course come from any source. Use the field parameter to determine whether the plot is asking for the x- or y- value.
Index X-Value Y-Value
0 1 f(1)
1 3 f(3)
2 9 f(9)
3 10 f(10)