Answered
Read data from complex *csv file
This code imports that very messed up "CSV" file (attached): opt = {'Delimiter',',', 'CollectOutput',true}; S = fileread...

8 years ago | 0

| accepted

Answered
Undefined variable error while the variable was indeed defined right before the use
@Kunhuan Liu: the reason is very simple: every function has its own workspace with its own variables: <https://www.mathworks....

8 years ago | 0

| accepted

Answered
Creating a conditional vector
Do NOT use a loop for this! >> a = [0,0,1,0;0,1,1,1;0,1,0,1;1,1,0,1] a = 0 0 1 0 0 1 1 1 0...

8 years ago | 0

| accepted

Answered
How do I output the same single parameter for a set of different files?
If you want to save the values from both loops, then you will need to use indexing corresponding to both loops. Currently you us...

8 years ago | 0

| accepted

Answered
How to change the size of the MATLAB GUI
<https://www.mathworks.com/matlabcentral/answers/153254-matlab-scaling-issue-on-high-resolution-high-dpi-displays>

8 years ago | 0

Answered
reshaping vector with uneven elements and zero padding
It would be simpler to use a cell array and |mat2cell|: >> A = [5,3,8,2,3,5,8]; >> B = [2,3,2]; >> C = mat2cell(A,1,B...

8 years ago | 1

Answered
Nested While and For Loop
You define |Eqn2| to be zero: Eqn2 = 0; and then inside the loop you try to access it using indexing: Eqn2(X1+Value...

8 years ago | 1

Answered
How to print result in matlab?
>> D1 = datenum('31.10.18','dd.mm.yy'); >> D2 = datenum('3.11.18','dd.mm.yy'); >> V = D1:D2; >> datestr(V(:),'dd.mm.y...

8 years ago | 1

| accepted

Answered
Pairwise matrix creation in matlab
>> R = [1,2,3]; >> C = [1;2;3]; >> C./R ans = 1.00000 0.50000 0.33333 2.00000 1.00000 0.66667 ...

8 years ago | 0

Answered
how can i move a certain windw of a 3D array to another 3D array?
I suspect that the indexing is a red herring, and you just want this: window_cube = matrix3D(row1:row2, col1:col2, 1:Frames...

8 years ago | 0

Answered
New variable for each xlsread from a different file
As shown in the MATLAB documentation <https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html> ...

8 years ago | 1

| accepted

Answered
Error loading file that exists, after ls, will load one time and then won't load.
Possibly this is due to delays in synchronizing with Google drive: <https://www.mathworks.com/matlabcentral/answers/37906-goo...

8 years ago | 1

| accepted

Answered
How to separate a column into rows based on the element of a different column?
This is a lot easier if you simply store the scalar numeric values in one numeric array (use |cell2mat| if required): >> A ...

8 years ago | 1

| accepted

Answered
how to save figure with command
You do not say anything about the file format that you want to use, however these will likely cover you needs: doc print ...

8 years ago | 1

Answered
How can I use the function blkdiag without typing every single matrix?
"Do we have a simple and fast way to do this operation without typing every single one?" Of course, this is simple, just use a ...

8 years ago | 3

| accepted

Answered
could you please tell me how to extract data from any matfile for a particular latitude and longitude?
By using indexing: lat = 23; % the latitude you want. vec = 0:100; idx = lat==vec; out = mat(:,idx,:,:)

8 years ago | 1

| accepted

Answered
How to find the second closest value to a specific value from a given matrix
Exactly as I showed you in <https://www.mathworks.com/matlabcentral/answers/426517-how-to-find-the-value-closest-to-1-from-a-x-y...

8 years ago | 0

| accepted

Answered
Shifting row and column of a matrix with minimum and maximum to the top and right repectively?
A simple MATLAB way (no loops, just basic indexing): >> M = randi(9,7,5) M = 5 1 4 1 9 7 8 2 6...

8 years ago | 1

Answered
Help my imputdata not solve
Importing that file (attached) is made more complicated by the fact that is uses a _decimal comma_, whereas MATLAB only parses a...

8 years ago | 1

| accepted

Answered
Delete Lines if there are three e qual lines
This should get you started: >> A = [1,3,7,8,9,7,2,8;9,0,3,5,2,1,4,9;0,2,3,6,2,7,7,7;3,2,3,5,2,2,5,7] A = 1 3 ...

8 years ago | 1

Answered
How can i change the precision using datenum?
The basic problem is that |intersect| tests for exact equivalency of floating point numbers (which is all that |datenum|'s are)....

8 years ago | 0

| accepted

Answered
How do I find absolute max value in a vector without losing the sign when the value is negative in MatLab R2011b?
*Method one:* use indexing to select from the original vector: >> V = [2,6,-7]; >> [~,X] = max(abs(V)); >> V(X) an...

8 years ago | 3

| accepted

Answered
fplot gives me an error "function behaves unexpectedly on array inputs".
_"Doese anyone know how to fix this?"_ The <https://www.mathworks.com/help/matlab/ref/fplot.html |fplot|> documentation descr...

8 years ago | 0

Answered
How to find the value closest to 1 from a x*y*z double matrix ?
>> [~,x] = min(abs(k(:)-1)); >> [p,n,m] = ind2sub(size(k),x) p = 6 n = 9 m = 2 >> k(p,n,m) ans = 0.99869...

8 years ago | 0

| accepted

Answered
Perform a program that shows the series 1!/2!, 2!/3!, 3!/4!, .....
A loop is not required, simple vectorized code will do this: >> V = factorial(1:11); >> V(1:10)./V(2:11) ans = ...

8 years ago | 0

Answered
How do you create a string from two strings by intersecting them char by char to form a new word using a loop?
Loop not required, just use indexing: *Method one:* >> str1 = 'Hello'; >> str2 = 'Canada'; >> strN = [str1,str2]; ...

8 years ago | 1

| accepted

Answered
problem of generations of values in a matrix
>> V = [4,3,2]; % [#1s, #2s, #3s, etc.] >> F = @(v,n)n*ones(1,v); >> C = arrayfun(F,V,1:numel(V),'uni',0); % or use REPE...

8 years ago | 1

Answered
how i change the data from column to rows. it try on transpose but give wrong result.
C = cellstr(P).' ^^ you need to transpose if you want a row cell vector.

8 years ago | 1

| accepted

Load more