Answered

Help needed vectorizing layer-wise 3d logical indexing problem.

% Creating Sample A and B matrix A=rand(3,4); B= (rand(3,4,5))>0.5; % one liner equivalent to your code. C=mat...

Help needed vectorizing layer-wise 3d logical indexing problem.

% Creating Sample A and B matrix A=rand(3,4); B= (rand(3,4,5))>0.5; % one liner equivalent to your code. C=mat...

meer dan 6 jaar ago | 1

| accepted

Answered

how to calculate neighbouring cells on a matrix?

use a combination of <http://www.mathworks.com/help/images/ref/padarray.html padarray()> and <http://www.mathworks.com/help/matl...

how to calculate neighbouring cells on a matrix?

use a combination of <http://www.mathworks.com/help/images/ref/padarray.html padarray()> and <http://www.mathworks.com/help/matl...

meer dan 6 jaar ago | 2

| accepted

Answered

How can I use "for loop" for this script?

Looking at your code: A0=X(:,m); A1=[X(:,m-1); A0]; A2=[X(:,m-2); A1]; A3=[X(:,m-3); A2]; A4=[X(:,m-4); A3]; ...

How can I use "for loop" for this script?

Looking at your code: A0=X(:,m); A1=[X(:,m-1); A0]; A2=[X(:,m-2); A1]; A3=[X(:,m-3); A2]; A4=[X(:,m-4); A3]; ...

meer dan 6 jaar ago | 0

| accepted

Answered

Load .mat file from anyfolder

load C:\myFolder\mySubFolder\myMatFile.mat or variableName= 'myVarName'; matfilePath = 'C:\myFolder\mySubFolder\myM...

Load .mat file from anyfolder

load C:\myFolder\mySubFolder\myMatFile.mat or variableName= 'myVarName'; matfilePath = 'C:\myFolder\mySubFolder\myM...

meer dan 6 jaar ago | 0

| accepted

Answered

how do i convert time domain signal to frequency domain signal?

<http://www.mathworks.com/help/matlab/ref/fft.html fft()> is one

how do i convert time domain signal to frequency domain signal?

<http://www.mathworks.com/help/matlab/ref/fft.html fft()> is one

meer dan 6 jaar ago | 0

| accepted

Answered

How to select the first letter of every word

str='I like eating pizza'; str2=cellfun(@(c) c(1),strsplit(str))

How to select the first letter of every word

str='I like eating pizza'; str2=cellfun(@(c) c(1),strsplit(str))

meer dan 6 jaar ago | 1

| accepted

Answered

Adding SPMD results - no loop

% Creating random sample data finalImageAll{1}=rand(3,3); finalImageAll{2}=rand(3,3); finalImageAll{3}=rand(3,3); ...

Adding SPMD results - no loop

% Creating random sample data finalImageAll{1}=rand(3,3); finalImageAll{2}=rand(3,3); finalImageAll{3}=rand(3,3); ...

meer dan 6 jaar ago | 1

| accepted

Answered

Change the values of a matrix using indices of another matrix

mask = (B==1) A(mask) = A(mask) + 5 if B is only zero and one then A(logical(B)) = A(logical(B)) + 5; and if B i...

Change the values of a matrix using indices of another matrix

mask = (B==1) A(mask) = A(mask) + 5 if B is only zero and one then A(logical(B)) = A(logical(B)) + 5; and if B i...

meer dan 6 jaar ago | 1

| accepted

Answered

I am trying to write a MatLab program to form a table of values for time, V(t), I(t), P(t), W(t). I have Volts and Amps, but can't insert P(t) and W(t)

t=0:.01:.25; V=10*exp(-20*t); I=-200*exp(-20*t); P=I.*V; W=0.5*(100e-6)*V.^2 table=[t;V;I;P;W]; fprintf(...

I am trying to write a MatLab program to form a table of values for time, V(t), I(t), P(t), W(t). I have Volts and Amps, but can't insert P(t) and W(t)

t=0:.01:.25; V=10*exp(-20*t); I=-200*exp(-20*t); P=I.*V; W=0.5*(100e-6)*V.^2 table=[t;V;I;P;W]; fprintf(...

meer dan 6 jaar ago | 0

| accepted

Answered

How to show Column and Row numbers in Matrix

A=[1 2 3 40 5 6 7 800 9]; format = sprintf('%%%d',max(floor(log10(A(:)))+1)); fprintf([format 'c '],'-')...

How to show Column and Row numbers in Matrix

A=[1 2 3 40 5 6 7 800 9]; format = sprintf('%%%d',max(floor(log10(A(:)))+1)); fprintf([format 'c '],'-')...

meer dan 6 jaar ago | 0

| accepted

Answered

How can I import shape file (Yield data points) and display the map?

Yes, you need Mapping Toolbox installed. Then you can use <http://www.mathworks.com/help/map/ref/shaperead.html shaperead()> ...

How can I import shape file (Yield data points) and display the map?

Yes, you need Mapping Toolbox installed. Then you can use <http://www.mathworks.com/help/map/ref/shaperead.html shaperead()> ...

meer dan 6 jaar ago | 0

| accepted

Answered

Different cells with different array sizes and outputting them to textfile

assuming that *cellArray* is the variable storing your different cells; then: fid=fopen('outputfilename.txt','w'); if (f...

Different cells with different array sizes and outputting them to textfile

assuming that *cellArray* is the variable storing your different cells; then: fid=fopen('outputfilename.txt','w'); if (f...

meer dan 6 jaar ago | 0

| accepted

Answered

Problem opening excel csv file using xlsread

for CSV file you should use <http://www.mathworks.com/help/matlab/ref/readtable.html readtable()> or <http://www.mathworks.com/h...

Problem opening excel csv file using xlsread

for CSV file you should use <http://www.mathworks.com/help/matlab/ref/readtable.html readtable()> or <http://www.mathworks.com/h...

meer dan 6 jaar ago | 0

| accepted

Answered

aplly to matrix a probability distribution for submatrix

It appears for your case, if your kernel (or probability distribution) is symmetric you can use both <http://www.mathworks.com/h...

aplly to matrix a probability distribution for submatrix

It appears for your case, if your kernel (or probability distribution) is symmetric you can use both <http://www.mathworks.com/h...

meer dan 6 jaar ago | 0

| accepted

Answered

Power matrix A^t using for loop without overwriting previous values

A=[0 0 0.319; ... 0.49 0 0; ... 0 0.87 0.87]; at=nan(6,1); pt=nan(6,1); for t=0:5 At=A^t; ...

Power matrix A^t using for loop without overwriting previous values

A=[0 0 0.319; ... 0.49 0 0; ... 0 0.87 0.87]; at=nan(6,1); pt=nan(6,1); for t=0:5 At=A^t; ...

meer dan 6 jaar ago | 0

| accepted

Answered

How to convert a quarterly data to annual data

Assuming all years have all 4 quarters (no missing quarter) in row or column vector, i.e.: quarterlyData=[2013q1 2013q2 201...

How to convert a quarterly data to annual data

Assuming all years have all 4 quarters (no missing quarter) in row or column vector, i.e.: quarterlyData=[2013q1 2013q2 201...

meer dan 6 jaar ago | 0

| accepted

Answered

speeding up a function

Ok, somehow my post got deleted. I asked whether you have other classes or there are just these two classes. here is a sample...

speeding up a function

Ok, somehow my post got deleted. I asked whether you have other classes or there are just these two classes. here is a sample...

meer dan 6 jaar ago | 1

| accepted

Answered

cell2mat error due to element size?

Use <http://www.mathworks.com/help/matlab/ref/str2double.html str2double()> instead. C={'104', '98', '98', ...

cell2mat error due to element size?

Use <http://www.mathworks.com/help/matlab/ref/str2double.html str2double()> instead. C={'104', '98', '98', ...

meer dan 6 jaar ago | 1

| accepted

Answered

Reading datasets from .txt

Well something like this: filename='tmp.txt'; fid=fopen(filename,'r'); if (fid==-1) error('could not open %s for...

Reading datasets from .txt

Well something like this: filename='tmp.txt'; fid=fopen(filename,'r'); if (fid==-1) error('could not open %s for...

meer dan 6 jaar ago | 0

| accepted

Answered

remove lines in between bar

Use <http://www.mathworks.com/help/matlab/ref/stairs.html stairs()> command instead of bar to plot them

remove lines in between bar

Use <http://www.mathworks.com/help/matlab/ref/stairs.html stairs()> command instead of bar to plot them

meer dan 6 jaar ago | 0

| accepted

Answered

finding highest values in string

x='asdqweqweasdddasdaaaaaaaaasdeeeeeer'; y='aed'; uniqueCharsNotInY=unique(x(~ismember(x,y))); charCou...

finding highest values in string

x='asdqweqweasdddasdaaaaaaaaasdeeeeeer'; y='aed'; uniqueCharsNotInY=unique(x(~ismember(x,y))); charCou...

meer dan 6 jaar ago | 0

| accepted

Answered

deleting words from a cell array

x={'areach';'aread';'areal'; ... 'areality';'arean';'arear'; ... 'areasoner';'areaway';'areca'; ... 'arecace...

deleting words from a cell array

x={'areach';'aread';'areal'; ... 'areality';'arean';'arear'; ... 'areasoner';'areaway';'areca'; ... 'arecace...

meer dan 6 jaar ago | 0

| accepted

Answered

Replace an element in a vector with another element.

g=[1 2 3 4 5 6 7 8 9]; u=[1 1 3 5 4 3 7 8 9]; gout=min([g;u]) gout = 1 1 3 4 4 ...

Replace an element in a vector with another element.

g=[1 2 3 4 5 6 7 8 9]; u=[1 1 3 5 4 3 7 8 9]; gout=min([g;u]) gout = 1 1 3 4 4 ...

meer dan 6 jaar ago | 0

| accepted

Answered

How to find the second zero element in an array?

index 5 is zero? You said you are looking for non-zero?!!! anyway you can use <http://www.mathworks.com/help/matlab/ref/find....

How to find the second zero element in an array?

index 5 is zero? You said you are looking for non-zero?!!! anyway you can use <http://www.mathworks.com/help/matlab/ref/find....

meer dan 6 jaar ago | 0

| accepted

Question

Getting an error each time opening a MFile for editing?

Hi, I have this machine with MATLAB R2015b on it? it seems it has some problem, running MATLAB. Any time I try to open a M-Fi...

meer dan 6 jaar ago | 1 answer | 0

Answered

Save while loop data?

You can do it like this: % first initialize myCoordList to an empty matrix myCoordList=[]; while (some condition)...

Save while loop data?

You can do it like this: % first initialize myCoordList to an empty matrix myCoordList=[]; while (some condition)...

meer dan 6 jaar ago | 7

| accepted

Answered

How to I combine different numbers of columns from two matrices?

No loop is needed. Check this: % Sample A and B A=repmat(1:4,3,1); % A has its column filled with number 1 to 4 A = ...

How to I combine different numbers of columns from two matrices?

No loop is needed. Check this: % Sample A and B A=repmat(1:4,3,1); % A has its column filled with number 1 to 4 A = ...

meer dan 6 jaar ago | 0

| accepted

Answered

Bend radius from coordinates section

You are looking to calculate Curvature. Here is the link with formula for you to calculate it: https://en.wikipedia.org/wiki/...

Bend radius from coordinates section

You are looking to calculate Curvature. Here is the link with formula for you to calculate it: https://en.wikipedia.org/wiki/...

meer dan 6 jaar ago | 2

| accepted

Answered

how can I combine two columns of an array A(m*2) in one column in the format: column1(column2)?

So, if I understood you right you have A of size Mx2 where the first column has either the character R or P and the second colum...

how can I combine two columns of an array A(m*2) in one column in the format: column1(column2)?

So, if I understood you right you have A of size Mx2 where the first column has either the character R or P and the second colum...

meer dan 6 jaar ago | 0

| accepted

Answered

rearranging a matrix and changing it dimensions

use <http://www.mathworks.com/help/matlab/ref/reshape.html reshape()> command: However, MATLAB rearranges using column order....

rearranging a matrix and changing it dimensions

use <http://www.mathworks.com/help/matlab/ref/reshape.html reshape()> command: However, MATLAB rearranges using column order....

meer dan 6 jaar ago | 0

| accepted