Réponse apportée

how to separate a matrix according to class labels?

classmatrices = splitapply(@(rows) {yourmatrix(rows, :)}, (1:size(yourmatrix, 1)'), yourmatrix(:, 3)) is one way. Note that in ...

how to separate a matrix according to class labels?

classmatrices = splitapply(@(rows) {yourmatrix(rows, :)}, (1:size(yourmatrix, 1)'), yourmatrix(:, 3)) is one way. Note that in ...

plus de 4 ans il y a | 1

Réponse apportée

Numeric matrix to string matrix

The easiest way, by far, to do this in matlab is: A = [1 2 45 4 ; 5 6 45 8]; %demo data result = discretize(A, [-Inf, 30, 50...

Numeric matrix to string matrix

The easiest way, by far, to do this in matlab is: A = [1 2 45 4 ; 5 6 45 8]; %demo data result = discretize(A, [-Inf, 30, 50...

plus de 4 ans il y a | 1

Réponse apportée

rounding numbers in a specific values

multiply by 2, round to the nearest integer, divide back by 2 => round to the nearest 1/2: >> Num = 10.25; >> round(Num*2)/2 ...

rounding numbers in a specific values

multiply by 2, round to the nearest integer, divide back by 2 => round to the nearest 1/2: >> Num = 10.25; >> round(Num*2)/2 ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée

Fastest way to find unique cells in a logical cell array

Why are you using a cell array to start with? A 6x6x4096 matrix would be more efficient in term of speed and memory. It also mak...

Fastest way to find unique cells in a logical cell array

Why are you using a cell array to start with? A 6x6x4096 matrix would be more efficient in term of speed and memory. It also mak...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée

remove all ones from matrix in combinantion

Your problem is a covering problem. A search on the file exchange may find some solutions there. I've not understand your after...

remove all ones from matrix in combinantion

Your problem is a covering problem. A search on the file exchange may find some solutions there. I've not understand your after...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée

Calculate multiple means in table by column indices

newtable = groupsummary(yourtable, {'Phase', 'Time'}, 'mean', 4:width(yourtable)) %mean of all but the first 3 variables, groupe...

Calculate multiple means in table by column indices

newtable = groupsummary(yourtable, {'Phase', 'Time'}, 'mean', 4:width(yourtable)) %mean of all but the first 3 variables, groupe...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée

How to subset data based on time range

It's not too clear what you mean by subsetting.If you want to bin the dates in ranges of 18 hours then use discretize: discreti...

How to subset data based on time range

It's not too clear what you mean by subsetting.If you want to bin the dates in ranges of 18 hours then use discretize: discreti...

plus de 4 ans il y a | 0

Réponse apportée

XML file generation in matlab

First, whenever you copy/paste code multiple times and only change an index each time you need to realise that you need to repla...

XML file generation in matlab

First, whenever you copy/paste code multiple times and only change an index each time you need to realise that you need to repla...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée

how to concatenate two tables into one such that the timestamps of two tables are in sequence and the corresponding values are arranged according to their timestamps

It should be very easy. Convert your tables to timetables (if they're not already) then call synchronize: speedtimetable = tabl...

how to concatenate two tables into one such that the timestamps of two tables are in sequence and the corresponding values are arranged according to their timestamps

It should be very easy. Convert your tables to timetables (if they're not already) then call synchronize: speedtimetable = tabl...

plus de 4 ans il y a | 1

Réponse apportée

How to show all cell contents

I want to see all the Genes array components Unless you code your own table display function, which would be a fair amount of w...

How to show all cell contents

I want to see all the Genes array components Unless you code your own table display function, which would be a fair amount of w...

plus de 4 ans il y a | 2

Réponse apportée

use of comma & semi colon

You're asking a very basic question. 5 minutes with any tutorial would have answered it. We recommend that you go through the fr...

use of comma & semi colon

You're asking a very basic question. 5 minutes with any tutorial would have answered it. We recommend that you go through the fr...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée

how to find y value from the 3d graph with a known x and z values

Seems fairly simply, just build a scattered interpolant and use that to interpolate your query points. x=[2.6,5.2,14,23.3,28.3,...

how to find y value from the 3d graph with a known x and z values

Seems fairly simply, just build a scattered interpolant and use that to interpolate your query points. x=[2.6,5.2,14,23.3,28.3,...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée

How to read numerics as strings with readtable?

opts = detectImportOptions(yourfile); opts = setvartype(opts, whichevervariable, 'string'); %or 'char' if you prefer data = r...

How to read numerics as strings with readtable?

opts = detectImportOptions(yourfile); opts = setvartype(opts, whichevervariable, 'string'); %or 'char' if you prefer data = r...

plus de 4 ans il y a | 10

| A accepté

Réponse apportée

Read text file with string

Should work in R2016a: filename = 'My2.TXK'; %using full path would be better [fid, errmsg] = fopen(filename, 'rt'); assert(...

Read text file with string

Should work in R2016a: filename = 'My2.TXK'; %using full path would be better [fid, errmsg] = fopen(filename, 'rt'); assert(...

plus de 4 ans il y a | 0

Réponse apportée

Calculate the mean of region with nonzero pixels

As I've answered in your other question: This requires a different approach altogether. You need to use one of the aggr...

Calculate the mean of region with nonzero pixels

As I've answered in your other question: This requires a different approach altogether. You need to use one of the aggr...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée

Is a project with source control via Github public?

This it not really a matlab question. Quick search on github help pages gives this link. If you need more help ask in a github f...

Is a project with source control via Github public?

This it not really a matlab question. Quick search on github help pages gives this link. If you need more help ask in a github f...

plus de 4 ans il y a | 0

Réponse apportée

Creating a matrix of all possible combinations of an array - MATLAB

" as opposed to making many for loops" Why would you use loops for this? %x: a vector of numbers x = 1:5; %n: number of elem...

Creating a matrix of all possible combinations of an array - MATLAB

" as opposed to making many for loops" Why would you use loops for this? %x: a vector of numbers x = 1:5; %n: number of elem...

plus de 4 ans il y a | 3

| A accepté

Réponse apportée

Double sum with upper limits

s = (1:size(d, 1)).'; result = sum(sum(d .* cos(s))) / sum(cos(s)); Loops not needed, they're just a waste of time.

Double sum with upper limits

s = (1:size(d, 1)).'; result = sum(sum(d .* cos(s))) / sum(cos(s)); Loops not needed, they're just a waste of time.

plus de 4 ans il y a | 1

| A accepté

Réponse apportée

How to extract data from .mat file that contains table

A structure and a table are two completely different things in matlab. Now, loadfile is always going to be a structure. The fie...

How to extract data from .mat file that contains table

A structure and a table are two completely different things in matlab. Now, loadfile is always going to be a structure. The fie...

plus de 4 ans il y a | 1

Réponse apportée

How do I delete cells in a column based on information from another column?

Considering the format of your spreadsheet you would be better off importing the data as a table. If I understood correctly what...

How do I delete cells in a column based on information from another column?

Considering the format of your spreadsheet you would be better off importing the data as a table. If I understood correctly what...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée

An error using fprintf

Any suggestions? Yes, for some reason, fopen failed to open the file. There can be many reasons, the most likely being that the...

An error using fprintf

Any suggestions? Yes, for some reason, fopen failed to open the file. There can be many reasons, the most likely being that the...

plus de 4 ans il y a | 0

Réponse apportée

Distance between all points of two vectors

Loops are rarely needed in matlab. They just make the code more complicated. Case in point: D = hypot(x-x.', y-y.'); All done!...

Distance between all points of two vectors

Loops are rarely needed in matlab. They just make the code more complicated. Case in point: D = hypot(x-x.', y-y.'); All done!...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée

Convert cell array into matrix, but with removing the words, commas, etc

Where does the cell array come from? If it's from a file import then the simplest thing is to fix the import. It is very likely ...

Convert cell array into matrix, but with removing the words, commas, etc

Where does the cell array come from? If it's from a file import then the simplest thing is to fix the import. It is very likely ...

plus de 4 ans il y a | 0

Réponse apportée

Fixing error while evaluating callback for GUI

From your code: ris=(get(findobj('tag','ris'),'string')); ristep=(get(findobj('tag','ristep'),'string')); We've got u...

Fixing error while evaluating callback for GUI

From your code: ris=(get(findobj('tag','ris'),'string')); ristep=(get(findobj('tag','ristep'),'string')); We've got u...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée

FillPattern of a Rectangle

Unfortunately for you, there is no such function in matlab. You may search the FileExchange to see if somebody has implemented s...

FillPattern of a Rectangle

Unfortunately for you, there is no such function in matlab. You may search the FileExchange to see if somebody has implemented s...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée

Dot indexing is not supported for variable of this type.

Any idea in how to fix this.? Not being snarky, but reading the documentation of the function would be the way to fix it. % ...

Dot indexing is not supported for variable of this type.

Any idea in how to fix this.? Not being snarky, but reading the documentation of the function would be the way to fix it. % ...

plus de 4 ans il y a | 0

Réponse apportée

How to create a histogram without using the matlab function

As Steven said, use discretize to find the bin indices and then one of the many aggregation functions in matlab. With 3 vector i...

How to create a histogram without using the matlab function

As Steven said, use discretize to find the bin indices and then one of the many aggregation functions in matlab. With 3 vector i...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée

need a code for a slider that can show different images for a volume of dicom images

How can I use the volume viewer ? I need a slider I don't think you can integrate in your own GUI, it's already a GUI on its ow...

need a code for a slider that can show different images for a volume of dicom images

How can I use the volume viewer ? I need a slider I don't think you can integrate in your own GUI, it's already a GUI on its ow...

plus de 4 ans il y a | 0

Réponse apportée

how to extract (x-y) coordinates after using the RECTANGLE function

%r: [X, Y, width, height] description of a rectangle, that would be pass to rectangle with: rectangle('Position', r) X = [r(1),...

how to extract (x-y) coordinates after using the RECTANGLE function

%r: [X, Y, width, height] description of a rectangle, that would be pass to rectangle with: rectangle('Position', r) X = [r(1),...

plus de 4 ans il y a | 0

Réponse apportée

How to calculate euclidean distance between two feature vectors

"Is this the right approachto find the euclidean distance?" Depends on which euclidean distance you're trying to calculate. Bo...

How to calculate euclidean distance between two feature vectors

"Is this the right approachto find the euclidean distance?" Depends on which euclidean distance you're trying to calculate. Bo...

plus de 4 ans il y a | 0