Community Profile

Zaza


12 total contributions since 2012

Contact

Contributions in
View by

Question


how can i convert an integer to an array in this function?
function a=get_array_num(n) end requirments: 1.no loops,if,recurion or logical operatos 2.no num2str or str2num ...

3 years ago | 1 Answers | 0

1

answer

Question


how do i create a recursive function that gives the number of digits in an integer? i.e. does the same that length function does in MATLAB
function r = length_of(n) end it seems to be easy but right now i'm stuck with it

3 years ago | 2 Answers | 0

2

answers

Question


How can I find a sub matrix of a matrix (of any size) where this happens:(Homework question)
For example: A = [21 25 -5 4; 21 25 -5 4; 22 26 21 22; 21 25 25 26; 21 25 -5 21]; the sub matrix of A is B = [21 25...

4 years ago | 1 Answers | 0

1

answer

Question


how can i check if n2 is a sub number of n1? (HW qst.)
for ex.: n1 = 123; n2 = 12; (n1>=n2) n2 is a sub number of n1 i can't make any use of strings or arrays

4 years ago | 3 Answers | 0

3

answers

Question


how can i compute the length of an integer?
if i have int = 12345; length_int = 5; ???

4 years ago | 3 Answers | 0

3

answers

Question


how can i get a matrix from an array like this:
Starting with a = [12 21 32]; I would like to get this: M = [12 21 32; 21 32 12; 32 12 21]; with size and leng...

4 years ago | 6 Answers | 0

6

answers

Question


how can i determine whether a matrix of any size is sorted or not (by rows and by columns)?
suppose i have A = [1 2 3 4; 5 6 7 8] is sorted but A = [1 2 3 4; 5 6 8 7] is not diff(A) returns "1"-s mtrix if columns a...

4 years ago | 2 Answers | 0

2

answers

Question


how can i sort a matrix (all rows and columns are sorted) without using any special function like "sort"?
i guess it has to do something with "min" and "max" functions... for example: A = [2 3 4 5; 6 9 1 5]; %%% "A" can be of ...

4 years ago | 3 Answers | 0

3

answers

Question


i need to convert a string to a num without using the "str2num" function but in the final answer i have some undesired spaces. how can i remove them?
st = '23487'; x = double(st); y = x-48; y = 2 3 4 8 7 i want this in "normal" format of "23487"...

4 years ago | 2 Answers | 0

2

answers

Question


how can i convert a string to a number (without using the str2num function) so if the string represents a number the value is 1? (otherwise the value is 0)...
for example: st = '23487'; r = 1; (also '00023487' is acceptable or any number of leading zeros). but st = '-4e';...

4 years ago | 2 Answers | 0

2

answers

Question


Specialized sorting of array while preserving order
how can i sort an array (of even number of elements) so the elements on the left side are smaller than the elements on the righ...

4 years ago | 1 Answers | 0

1

answer