Réponse apportée
Hello, is there a way to create mxArray from double *?
If by create you mean typecasting, then no. If by create you mean populate then yes: mwSize m = 100, n = 10; //Array size ...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How should I alter this sum?
Note the in _mat(1,25-j)_ the index needs to be superior to 0, otherwise an error will be returned. Considering that: nVals...

plus de 13 ans il y a | 0

Réponse apportée
Converting R code into Matlab code
No, they are different languages. You could however try some of the interfaces that are out there. <http://www.omegahat.or...

plus de 13 ans il y a | 0

Réponse apportée
Find value of variable in a equality
This is not really a Matlab question. You could explicitely solve this equation using some arithmetic. That said, you could alw...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
reading header line from text file
It means the position indicator is not at the beginning of the file after it exits textscan: You can either rewind: fid =...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How to 'who' the global workspace to a variable in a function ?
This sounds like a job for <http://www.mathworks.com/matlabcentral/fileexchange/7129 keep4>.

plus de 13 ans il y a | 0

Réponse apportée
reshape with a huge matrix
arrayfun(@(x) {mean(data(x,:),2},index,'uniformoutput',false);

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
index and matrix selection
cell2mat(arrayfun(@(x) {data(x,:)},index,'uniformoutput',false)); Using reshape should be faster though.

plus de 13 ans il y a | 0

| A accepté

A résolu


Nearest Numbers
Given a row vector of numbers, find the indices of the two nearest numbers. Examples: [index1 index2] = nearestNumbers([2 5 3...

plus de 13 ans il y a

A résolu


Create times-tables
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

plus de 13 ans il y a

A résolu


Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

plus de 13 ans il y a

Réponse apportée
sample vectors with pre-defined angle
I don't think there is. You could always try this: nDim = 5; point1 = randn(nDim,1); point2 = randn(nDim,1); vec = poi...

plus de 13 ans il y a | 0

Réponse apportée
corresponding index of an element
idx = find(g_counter == 0 & list == 0); or idx = find(~g_counter & ~list); or idx = find(g_counter - list == g_c...

plus de 13 ans il y a | 0

Réponse apportée
What are the best practice in mex ?
I don't mean to sound facetious, but poorly written code will generally be slower than well written code, independently of the l...

plus de 13 ans il y a | 0

Réponse apportée
way to use returned valued of a if clause
I assume you mean something like, in C/C++ style if (++i == some_value){ //do something with the new value of i } Th...

plus de 13 ans il y a | 0

Réponse apportée
how to remove the gap between subsequent plots
1. Create custom axes, e.g.: h1 = axes('Position',[0.1 0.1 0.4 0.4]); h2 = axes('Position',[0.1 0.5 0.4 0.4]); h3 = axes...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How to know the sequence of file in a large project
doc mfilename You could place that in all your .m files and see which ones get called. You could also look at doc dbsta...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Can array values be used in plot titles?
a = 1:10; all_titles = arrayfun(@(x) {num2str(x)},a); h = cell(1,10); for ii = 1:10; h(ii) = {subplot(1,10,ii)}; ...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Test randomness from STD deviation
No, the standard deviation by itself will tell you next to nothing about the nature of the distribution. Something like the two-...

plus de 13 ans il y a | 0

Réponse apportée
How can I properly export a figure using the 'patch' command?
Looks like your image is transformed to a bitmap. When you use patch, the renderer might be set to *OpenGL* by default. Try and ...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Complex Variables and Memory mapping
Yes, but you would need to use the C/C++ or FORTRAN <http://www.mathworks.se/help/matlab/apiref/_bqoqnz0.html api>. It provides ...

plus de 13 ans il y a | 1

Réponse apportée
read a text file or not read it
idx = 1:100; idx([50 69]) = []; %You could also use an if statement inside the loop, but this might be more efficient fo...

plus de 13 ans il y a | 0

Réponse apportée
Plotting in four data sets in quadrants of a single graph
I am not sure I understand what you mean. Subplot sounds like the solution for this problem. If by a single graph you mean you...

plus de 13 ans il y a | 0

Réponse apportée
save a data as mat file
I would recommend putting everything in a cell array, that you can then save. all_data = cell(10,1); for ii = 1:10 ...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Matlab built in functions
Hard to say. You would need to ask the Mathworks to show you their source code. I am rather sure they would be somewhat reluctan...

plus de 13 ans il y a | 0

Réponse apportée
JUST Take integer value number from decimal value
a = -3.1145 your_val = fix(a) If you also want it to work for negative numbers.

plus de 13 ans il y a | 2

| A accepté

Réponse apportée
Fully standalone executable file
You need to have Matlab runtime installed in the computer where you plan to run your project. Otherwise it will not work. You do...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
Colors in Polar Plots dissapearing when Scaling colorbar
Please read the documentation doc caxis From the description of your problem I would guess that the values in PhC are eit...

plus de 13 ans il y a | 0

Réponse apportée
How to make a reference to multiple subelements of a cell without for loop (to create a plot)
your_vals = cellfun(@(x) x(end),your_cell)

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Collecting all the data after running an M-file multiple times
Make your m-file a function and return the values you want to save. Look at doc function Quick example: function...

plus de 13 ans il y a | 0

| A accepté

Charger plus