Réponse apportée
Multiply pages of 3D array with each other
A = rand(512,10,16); [m,n,N]=size(A); pairs=nchoosek(1:N,2); B=zeros(m,n,size(pairs,1)); for k=1:size(B,3) B(:,:,k) =...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
Sharing with somebody who hasnt Matlab
MATLAB compiler

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How to plot circle with direction?
2D version. adapt to your need % circle parameter r = 5; cx = 0; cy = 0; cfun = @(tt) [cx+r*cos(tt); cy+r*sin(tt)]; xy...

presque 7 ans il y a | 4

Réponse apportée
Fast computation of an equation.
The efficientcy of the bellow method depend on m, n, s % Generate dummy test data m = 1000; n = 1000; s = 1000; W = rand(m,...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
Calculate the distance squared of a point in 3d space
function [distanceSquared] = PixelDistance(P,Q) P1 = P(1); P2 = P(2); P3 = P(3); Q1 = Q(1); Q2 = Q(2); Q3 = Q(3); distanceSqu...

presque 7 ans il y a | 0

Réponse apportée
Counting number of same neighbourhood pixels between two matrices.
This command counts the number of 3x3 neigbouring pixels that exactly match conv2(p1==p2,ones(3),'same')

presque 7 ans il y a | 0

Réponse apportée
Comparing a value against a set of values
if any(A,3) % ... end

presque 7 ans il y a | 1

Réponse apportée
Time in hr min sec to seconds
Purely arithmetics x=str2double('152605'); h=floor(x/1e4); y=mod(x,1e4); m=floor(y/1e2); s=mod(y,1e2); nsec=polyval([h,m,...

presque 7 ans il y a | 0

Réponse apportée
Time in hr min sec to seconds
polyval(str2num(reshape('152605',2,3)'),60)

presque 7 ans il y a | 0

Réponse apportée
Time in hr min sec to seconds
round((datenum('152605','HHMMSS')-datenum('000000','HHMMSS'))*86400)

presque 7 ans il y a | 1

Réponse apportée
Why is fprintf not printing the first whitespace in a string?
Read carefully FPRINTF document; the first argument after optional fid is a a FORMAT; not arguments. So you must add '%s' fprin...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How can I establish that my function must have a fixed value after a specific condition occurs?
Assuming your T contains 1,2,3. V = [0.5, 0, 1]; % values correspond to 1,2,3 S = V(T)

presque 7 ans il y a | 0

Réponse apportée
Attribute number to closed area
You might checkout POLYSHAPE, that can give you the regions P = polyshape(rand(10,2)); R = regions(P); close all plot(R); ...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How to plot a position heatmap inside a circle?
Hide the ouside with a patch close all im=peaks; % your heatmap imagesc(im) ax = gca; xl = xlim(ax); yl = ylim(ax)...

presque 7 ans il y a | 1

Réponse apportée
Raising a matrix to a power
% This script will generate a plot of pressure P (in bar) as a function of molar % volume V (in cm^3/mol) for various values of...

presque 7 ans il y a | 0

Réponse apportée
How to compute the ratio of the insection point in each grid on the boundary of a real structure
Assuming the boundary has one connexed piece x=-3:12; y=-3:10; [X,Y]=meshgrid(x,y); cx = 4; cy = 3; r = 5; Z = (X-c...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How to merge words in the cells to form a string
a_=a'; % then copy screen followed by useless screen capture. Please do a__ = a(1:10); save(' a__.mat','a__'); and attach t...

presque 7 ans il y a | 0

Réponse apportée
Sorting points based on comparing distances.
You might learn to use Delaunay triangulation that can find nearrest points much more efficiently than pdist2 or such (applicabl...

presque 7 ans il y a | 0

Réponse apportée
I wish to open a saved figure in the figure number of my choice.
clear close all fig=figure(); plot(rand(1,10)); hgsave(fig,'myfig.fig'); input('type <CR> to continue and see load file <...

presque 7 ans il y a | 0

Réponse apportée
Generate 50000 binary sequence of 16 bits long (without repetition) without using "rand(1,16) > 0.5" logic
c=dec2bin(randperm(2^16,50000)-1,16) a=c-'0' % if you need binary arrays

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How can we create two vectors have normally distributed random entries with zero mean?
I correct the flaw of dpb method U=randn(10,1); V=randn(10,1); ps=U.'*V; a=sqrt(abs(ps)); U=(sign(ps)/a)*U; V=(1/a)*V;

presque 7 ans il y a | 2

| A accepté

Réponse apportée
How to merge words in the cells to form a string
A={{"happy" "birdday"} {"I" "am" "a" "boy"} {"good" "boy"}}; S = strtrim(string(char(cellfun(@(c) sprintf('%s ',c{:}), A, 'un...

presque 7 ans il y a | 0

Réponse apportée
Updating constraints in fmincon at while loop
The number of non-linear constraints can be dynamically changed during the run of FMINCON. You can then set the OutputFun, trac...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
reshaping a 3D array
[m,n,p] = size(Colours); ColoursRearrange = reshape(permute(reshape(Colours,m,n,3,[]),[1 2 4 3]),[m n p]);

presque 7 ans il y a | 0

Réponse apportée
How to resolve this error Error using fprintf Function is not defined for 'cell' inputs.
Not sure the formatting display you want, I simply fix some of issues your code so it can run n=6; C1i={[0],[1 2 4],[2 3 4]...

presque 7 ans il y a | 0

Réponse apportée
Anomalous histogram for small argument
Yes it is a BUG. I chase back and in the file C:\Program Files\MATLAB\R2019a\toolbox\matlab\datafun\+matlab\+internal\+math\bin...

presque 7 ans il y a | 2

| A accepté

Réponse apportée
How to improve the accuracy of lu decomposition?
If you want to check accuracy of LU decomposition you should check unitless quantity error = norm(L*U-A) / norm(A) norm(.) is...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How extract a specific digit from binary number
b(end-flip(7:10)+1)

presque 7 ans il y a | 0

Réponse apportée
how to change a number of base n to base m
>> dec2base(124,5) ans = '444' >> dec2base(122,4) ans = '1322' >> base2dec('1444',5) ans = 24...

presque 7 ans il y a | 0

Réponse apportée
changing a matrix size
% A is 144 x 144 input binary matrix I512 = logical(interp2(... linspace(0,1,size(A,2)),... linsp...

presque 7 ans il y a | 0

| A accepté

Charger plus