Answered

Write a function called max_sum that takes v, a row vector of numbers, and n, a positive integer as inputs. The function needs to find the n consecutive elements of v whose sum is the largest possible.

Don't use the question title to post the content of your assignment as that get truncated. Assuming that your assigment is to f...

Write a function called max_sum that takes v, a row vector of numbers, and n, a positive integer as inputs. The function needs to find the n consecutive elements of v whose sum is the largest possible.

Don't use the question title to post the content of your assignment as that get truncated. Assuming that your assigment is to f...

6 jours ago | 2

| accepted

Answered

splitapply cumsum with non-scalar result

The error message tells you exactly what to do: splitapply(@(x){cumsum(x)}, inputData, G) This will output a cell array, ...

splitapply cumsum with non-scalar result

The error message tells you exactly what to do: splitapply(@(x){cumsum(x)}, inputData, G) This will output a cell array, ...

6 jours ago | 0

| accepted

Answered

Expressing an even number in powers of 2 and a multiple of an odd number.

Can't you just use a loop? function [exponent, multiplicand] = decompose(number) validateattributes(number, {'numeric'}, ...

Expressing an even number in powers of 2 and a multiple of an odd number.

Can't you just use a loop? function [exponent, multiplicand] = decompose(number) validateattributes(number, {'numeric'}, ...

6 jours ago | 0

| accepted

Answered

code is too difficult to understand

I'm not sure what you're looking for here. We're not going to teach you matlab, so perhaps you should grab a book and/or read so...

code is too difficult to understand

I'm not sure what you're looking for here. We're not going to teach you matlab, so perhaps you should grab a book and/or read so...

6 jours ago | 0

Answered

Extract array information from date and create cell

dates = datetime(datestr(dates)); %... datenumber = datenum(dates); The trip through datestr is unnecessary. And converting a...

Extract array information from date and create cell

dates = datetime(datestr(dates)); %... datenumber = datenum(dates); The trip through datestr is unnecessary. And converting a...

6 jours ago | 0

Answered

merging 8 bit planes into single plane by combining the values of each bit into 8-bit value for each pixel

No, imfuse will not work. imfuse has no concept of bits. Your question is actually very puzzling. You already know how to combi...

merging 8 bit planes into single plane by combining the values of each bit into 8-bit value for each pixel

No, imfuse will not work. imfuse has no concept of bits. Your question is actually very puzzling. You already know how to combi...

6 jours ago | 0

| accepted

Answered

Reading uint16 image and converting to uint8 problem

As far as I can tell, there is nothing wrong with the way matlab decodes your image. It genuinely have very little contrast with...

Reading uint16 image and converting to uint8 problem

As far as I can tell, there is nothing wrong with the way matlab decodes your image. It genuinely have very little contrast with...

7 jours ago | 0

| accepted

Answered

How do I make a function accept a vector as an input

If you want to pass the first, second, third, or nth element of the input vector to your function, then tell matlab you want the...

How do I make a function accept a vector as an input

If you want to pass the first, second, third, or nth element of the input vector to your function, then tell matlab you want the...

7 jours ago | 1

| accepted

Answered

How to get the intersecting coordinates of a binary image?

You would use the 'branchpoints' operation of bwmorph to isolate the intersections, after you've skeletonised the image with the...

How to get the intersecting coordinates of a binary image?

You would use the 'branchpoints' operation of bwmorph to isolate the intersections, after you've skeletonised the image with the...

7 jours ago | 0

| accepted

Answered

how to optimise the code with cell?

Why are you using cell arrays in the first place? It's just slower and has more overhead than matrices. You can just create your...

how to optimise the code with cell?

Why are you using cell arrays in the first place? It's just slower and has more overhead than matrices. You can just create your...

7 jours ago | 0

| accepted

Answered

How to segment a paragraph into lines and words?

Of course it's possible to segment the file. It's fairly trivial as well. Just close the image (if you're working with white tex...

How to segment a paragraph into lines and words?

Of course it's possible to segment the file. It's fairly trivial as well. Just close the image (if you're working with white tex...

7 jours ago | 0

| accepted

Answered

Is is necessary to use set/get functions?

It's not been required since R2014b, where all graphics handles became proper objects. Now, it is just an alternative way of set...

Is is necessary to use set/get functions?

It's not been required since R2014b, where all graphics handles became proper objects. Now, it is just an alternative way of set...

8 jours ago | 0

| accepted

Answered

Error for C(i,:)

As per my comment to your question, clearly your code is full of bugs. To find out how your code actually behaves as opposed to ...

Error for C(i,:)

As per my comment to your question, clearly your code is full of bugs. To find out how your code actually behaves as opposed to ...

8 jours ago | 0

Answered

Dicomwrite, how to overcome limits of 32-bit?

As far as I know, the 2^32-1 limit is intrinsic to the DICOM format. The length in bytes of all objects is always encoded as a ...

Dicomwrite, how to overcome limits of 32-bit?

As far as I know, the 2^32-1 limit is intrinsic to the DICOM format. The length in bytes of all objects is always encoded as a ...

8 jours ago | 0

| accepted

Answered

Categorising coordinates into a table

Is there any reason to store your data as a cell array instead of a 3D matrix (or two 2D matrices) which would make your life si...

Categorising coordinates into a table

Is there any reason to store your data as a cell array instead of a 3D matrix (or two 2D matrices) which would make your life si...

8 jours ago | 1

| accepted

Answered

How to fill a 1024 point array with two cycles of a cosine wave?

Knowing that the cycle length of a cosine wave is , what is the length of two cycles? Once you know that, use linspace to gener...

How to fill a 1024 point array with two cycles of a cosine wave?

Knowing that the cycle length of a cosine wave is , what is the length of two cycles? Once you know that, use linspace to gener...

8 jours ago | 0

Answered

How do I extract numbers from mixed data to create a table?

Your log1.txt file is encoded in UTF8 and starts with a BOM (a bit unusual). Reading as text without telling matlab it's utf8 ma...

How do I extract numbers from mixed data to create a table?

Your log1.txt file is encoded in UTF8 and starts with a BOM (a bit unusual). Reading as text without telling matlab it's utf8 ma...

8 jours ago | 0

Answered

Rearranging rows side by side based on a column value

I'm assuming that status 1 only happens once per ID. I'm also assuming that all rows of an ID are together. t = readtable('Inpu...

Rearranging rows side by side based on a column value

I'm assuming that status 1 only happens once per ID. I'm also assuming that all rows of an ID are together. t = readtable('Inpu...

8 jours ago | 0

| accepted

Answered

Combine Vectors Into Matrix - NOT ALL Possible Combinations from baseline

allpoints = {[1 2 3 4], [7 8 9], [10 11 12 13], [14 15 16]}; %can be as many vectors of any length baseline = [1 7 10 14]; ass...

Combine Vectors Into Matrix - NOT ALL Possible Combinations from baseline

allpoints = {[1 2 3 4], [7 8 9], [10 11 12 13], [14 15 16]}; %can be as many vectors of any length baseline = [1 7 10 14]; ass...

8 jours ago | 1

| accepted

Answered

Get Blob from Firebird SQL Database

So, what you're getting back is a java object of type org.firebirdsql.jdbc.FBBlob. You can use the methods of that object to get...

Get Blob from Firebird SQL Database

So, what you're getting back is a java object of type org.firebirdsql.jdbc.FBBlob. You can use the methods of that object to get...

8 jours ago | 0

| accepted

Answered

How to put each group of cells in the same row ?

reshape(A, 16, [])' reshapes your cell array in columns of 16 rows (since matlab is column major). Then transpose to have rows ...

How to put each group of cells in the same row ?

reshape(A, 16, [])' reshapes your cell array in columns of 16 rows (since matlab is column major). Then transpose to have rows ...

8 jours ago | 1

| accepted

Answered

Reading Specific Data Into MATLAB from an Excel File

One way: opts = detectImportOptions('Static_pose.xlsx'); %should automatically figure out what part of the excel file is a tab...

Reading Specific Data Into MATLAB from an Excel File

One way: opts = detectImportOptions('Static_pose.xlsx'); %should automatically figure out what part of the excel file is a tab...

8 jours ago | 0

Answered

Intersection of two matrices based on 1st column

[~, rowstokeep] = setdiff(B(:, 1), A(:, 1)); %get index of rows in B whose 1st column is not in 1st column of A C = B(rowstoke...

Intersection of two matrices based on 1st column

[~, rowstokeep] = setdiff(B(:, 1), A(:, 1)); %get index of rows in B whose 1st column is not in 1st column of A C = B(rowstoke...

8 jours ago | 0

| accepted

Answered

Warning while opening matlab R2018b

The most important part of the error is probably: Warning: Function assert has the same name as a MATLAB builtin. We suggest yo...

Warning while opening matlab R2018b

The most important part of the error is probably: Warning: Function assert has the same name as a MATLAB builtin. We suggest yo...

8 jours ago | 0

| accepted

Answered

How to efficiently replace NAN with Numirical value a reference vector

Certainly, the inner for loop is unnecessary (and the find, use logical indexing). Refr=[1 20 1 4 5 2]; WithNan=[1 NaN 1 3 2 ...

How to efficiently replace NAN with Numirical value a reference vector

Certainly, the inner for loop is unnecessary (and the find, use logical indexing). Refr=[1 20 1 4 5 2]; WithNan=[1 NaN 1 3 2 ...

11 jours ago | 3

Answered

To change 12x12 matrix to 6X12

No need for a loop: m = randi([0 100], 12) %demo matrix newm = permute(sum(reshape(m.', size(m, 2), 2, []), 2), [3 1 2]) B...

To change 12x12 matrix to 6X12

No need for a loop: m = randi([0 100], 12) %demo matrix newm = permute(sum(reshape(m.', size(m, 2), 2, []), 2), [3 1 2]) B...

12 jours ago | 1

Answered

Removing zeros in excel

No loop, no cellfun: filetoedit = 'C:\somewhere\somefile.xlsx'; [data, ~, ascell] = xlsread(filetoedit); ascell(~conv2(data...

Removing zeros in excel

No loop, no cellfun: filetoedit = 'C:\somewhere\somefile.xlsx'; [data, ~, ascell] = xlsread(filetoedit); ascell(~conv2(data...

12 jours ago | 1

| accepted

Answered

undefined function or variable matlab even the variable excite

A will only exist if both n and m are greater than 2. So if matlab tells you that A does not exist we can safely assume that eit...

undefined function or variable matlab even the variable excite

A will only exist if both n and m are greater than 2. So if matlab tells you that A does not exist we can safely assume that eit...

12 jours ago | 0

Answered

number of special array in a table

It doesn't look like you have a table. It looks like a plain vector. Anyway, lengthofruns = diff([1; find(isnan(yourvector)); ...

number of special array in a table

It doesn't look like you have a table. It looks like a plain vector. Anyway, lengthofruns = diff([1; find(isnan(yourvector)); ...

14 jours ago | 1

| accepted

Answered

what happens to Matlab when I lose connection to my network drive data all of a sudden?

As YT said, fixing the problem may be a more efficient use of your time than trying to work around it. Assuming you have enough ...

what happens to Matlab when I lose connection to my network drive data all of a sudden?

As YT said, fixing the problem may be a more efficient use of your time than trying to work around it. Assuming you have enough ...

14 jours ago | 2