Risposto
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...

oltre 8 anni fa | 1

| accettato

Risposto
how to calculate neighbouring cells on a matrix?

oltre 8 anni fa | 2

| accettato

Risposto
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]; ...

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

| accettato

Risposto
how do i convert time domain signal to frequency domain signal?
<http://www.mathworks.com/help/matlab/ref/fft.html fft()> is one

oltre 8 anni fa | 0

| accettato

Risposto
How to select the first letter of every word
str='I like eating pizza'; str2=cellfun(@(c) c(1),strsplit(str))

oltre 8 anni fa | 1

| accettato

Risposto
Adding SPMD results - no loop
% Creating random sample data finalImageAll{1}=rand(3,3); finalImageAll{2}=rand(3,3); finalImageAll{3}=rand(3,3); ...

oltre 8 anni fa | 1

| accettato

Risposto
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...

oltre 8 anni fa | 1

| accettato

Risposto
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(...

oltre 8 anni fa | 0

| accettato

Risposto
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 '],'-')...

oltre 8 anni fa | 0

| accettato

Risposto
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()> ...

oltre 8 anni fa | 0

| accettato

Risposto
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...

oltre 8 anni fa | 0

| accettato

Risposto
Problem opening excel csv file using xlsread

oltre 8 anni fa | 0

| accettato

Risposto
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...

oltre 8 anni fa | 0

| accettato

Risposto
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; ...

oltre 8 anni fa | 0

| accettato

Risposto
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...

oltre 8 anni fa | 0

| accettato

Risposto
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...

oltre 8 anni fa | 1

| accettato

Risposto
cell2mat error due to element size?
Use <http://www.mathworks.com/help/matlab/ref/str2double.html str2double()> instead. C={'104', '98', '98', ...

oltre 8 anni fa | 1

| accettato

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

| accettato

Risposto
finding highest values in string
x='asdqweqweasdddasdaaaaaaaaasdeeeeeer'; y='aed'; uniqueCharsNotInY=unique(x(~ismember(x,y))); charCou...

oltre 8 anni fa | 0

| accettato

Risposto
deleting words from a cell array
x={'areach';'aread';'areal'; ... 'areality';'arean';'arear'; ... 'areasoner';'areaway';'areca'; ... 'arecace...

oltre 8 anni fa | 0

| accettato

Risposto
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 ...

oltre 8 anni fa | 0

| accettato

Risposto
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....

oltre 8 anni fa | 0

| accettato

Domanda

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...

oltre 8 anni fa | 1 risposta | 0

### 1

risposta

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

oltre 8 anni fa | 8

| accettato

Risposto
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 = ...

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 2

| accettato

Risposto
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...

oltre 8 anni fa | 0

| accettato

Risposto
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....

oltre 8 anni fa | 0

| accettato